diff --git a/.github/workflows/rust-build-and-test.yml b/.github/workflows/rust-build-and-test.yml index 88309f2f2..b1f58553e 100644 --- a/.github/workflows/rust-build-and-test.yml +++ b/.github/workflows/rust-build-and-test.yml @@ -75,6 +75,8 @@ jobs: run: make test build: runs-on: ubuntu-latest + outputs: + image: ${{ steps.build.outputs.build_tag }} steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable @@ -99,5 +101,68 @@ jobs: echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV - name: Build run: make build + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to Public ECR + uses: docker/login-action@v2 + with: + registry: public.ecr.aws + username: ${{ secrets.AWS_ACCESS_KEY_ID }} + password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + env: + AWS_REGION: us-east-1 + - + name: Build and Publish + id: build + run: | + SHA_TAG=$(echo ${{ github.SHA }} | head -c 12) + BUILD_TAG=$SHA_TAG + COMMIT_MESSAGE=$(git log -1 --pretty=%B) + if [[ $(echo "$COMMIT_MESSAGE" | grep 'chore: version v') ]]; then + RELEASE_TAG=$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' | tr -d '"') + # Use the release tag to deploy, if one is available. + BUILD_TAG=$RELEASE_TAG + fi + make SHA="${{ github.SHA }}" SHA_TAG="$SHA_TAG" RELEASE_TAG="$RELEASE_TAG" publish-docker + echo "Build tag:" + echo ${BUILD_TAG} + echo "build_tag=${BUILD_TAG}" >> $GITHUB_OUTPUT + correctness-tests: + runs-on: ubuntu-latest + environment: github-tests-2024 + needs: + - build + steps: + - uses: actions/checkout@v3 + - name: Get Network template and update + env: + RUST_CERAMIC_IMAGE: ${{ needs.build.outputs.build_tag }} + run: | + sudo apt-get update && apt-get install -y curl yq + curl -LO https://github.com/3box/ceramic-tests/releases/download/v0.2.0/hermetic-driver-x86_64-linux + mv hermetic-driver-x86_64-linux ./bin/hermetic-driver + chmod +x ./bin/hermetic-driver + curl -LO https://raw.githubusercontent.com/3box/ceramic-tests/main/networks/basic-rust.yaml + yq e '.spec.ceramic[0].ipfs.rust.image = strenv(RUST_CERAMIC_IMAGE)' basic-rust.yaml + cat basic-rust.yaml + - + name: Setup GKE auth + uses: 'google-github-actions/auth@v1' + with: + credentials_json: ${{ secrets.GKE_SA_KEY }} + - + name: Get GKE credentials + uses: 'google-github-actions/get-gke-credentials@v1' + with: + cluster_name: ${{ vars.GKE_CLUSTER }} + location: ${{ vars.GKE_ZONE }} + - name: Run correctness-tests + run: | + ./bin/hermetic-driver test \ + --network basic-rust.yaml \ + --flavor smoke \ + --test-selector "fast"