From 835e6fde9416ebcdf65b9c016f8e53885145e24c Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 11 Dec 2024 15:39:21 -0500 Subject: [PATCH] chore: merge queue CI (#10629) This should prevent 'bad stuff' from getting into master --- .github/workflows/ci.yml | 120 ++++++++++++++++++++++----------------- 1 file changed, 69 insertions(+), 51 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99625e35fb3..1b0da3a15b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: - master - provernet - "*/ci-push*" + merge_group: pull_request: types: - opened @@ -17,8 +18,8 @@ on: inputs: {} concurrency: - # force parallelism in master - group: ci-${{ github.ref_name == 'master' && github.run_id || github.ref_name }} + # allow parallelism in master and merge queue + group: ci-${{ (contains(github.ref_name, 'gh-readonly-queue') || github.ref_name == 'master') && github.run_id || github.ref_name }} cancel-in-progress: true env: @@ -158,13 +159,15 @@ jobs: # prepare images locally, tagged by commit hash - name: "Build E2E Image" timeout-minutes: 40 - if: (needs.configure.outputs.non-docs == 'true' && needs.configure.outputs.non-barretenberg-cpp == 'true') || github.ref_name == 'master' + if: needs.configure.outputs.non-docs == 'true' run: | earthly-ci ./yarn-project+export-e2e-test-images # We base our e2e list used in e2e-x86 off the targets in ./yarn-project/end-to-end # (Note ARM uses just 2 tests as a smoketest) - name: Create list of non-bench end-to-end jobs id: e2e_list + env: + REF: contains(github.ref_name, 'gh-readonly-queue') && 'master' || github.ref_name run: | if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then LABELS=$(jq -r '.pull_request.labels | map(.name) | join(",")' "$GITHUB_EVENT_PATH") @@ -172,23 +175,46 @@ jobs: LABELS="" fi echo Labels: $LABELS - echo "list=$(./scripts/ci/get_e2e_jobs.sh ${{github.ref_name}} "$LABELS")" - echo "list=$(./scripts/ci/get_e2e_jobs.sh ${{github.ref_name}} "$LABELS")" >> $GITHUB_OUTPUT + echo "list=$(./scripts/ci/get_e2e_jobs.sh $REF "$LABELS")" + echo "list=$(./scripts/ci/get_e2e_jobs.sh $REF "$LABELS")" >> $GITHUB_OUTPUT - name: Create list of bench end-to-end jobs id: bench_list + env: + REF: contains(github.ref_name, 'gh-readonly-queue') && 'master' || github.ref_name run: | if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then LABELS=$(jq -r '.pull_request.labels | map(.name) | join(",")' "$GITHUB_EVENT_PATH") else LABELS="" fi - echo Labels: $LABELS - echo "list=$(./scripts/ci/get_bench_jobs.sh ${{github.ref_name}} "$LABELS")" >> $GITHUB_OUTPUT + echo "list=$(./scripts/ci/get_bench_jobs.sh $REF "$LABELS")" + echo "list=$(./scripts/ci/get_bench_jobs.sh $REF "$LABELS")" >> $GITHUB_OUTPUT + + bench-test-gate: + needs: [build, configure] + if: contains(github.ref_name, 'gh-readonly-queue') || github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'bench-all') + runs-on: ubuntu-20.04 + steps: + - run: "echo Full bench tests enabled." + + e2e-test-gate: + needs: [build, configure] + if: contains(github.ref_name, 'gh-readonly-queue') || github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'e2e-all') + runs-on: ubuntu-20.04 + steps: + - run: "echo Full E2E tests enabled." + + network-test-gate: + needs: [build, configure] + if: github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'network-all') + runs-on: ubuntu-20.04 + steps: + - run: "echo Full network tests enabled." # all the non-bench end-to-end integration tests for aztec e2e: - needs: [build, configure] - if: (needs.configure.outputs.non-docs == 'true' && needs.configure.outputs.non-barretenberg-cpp == 'true') || github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'e2e') + needs: [build, e2e-test-gate, configure] + if: needs.configure.outputs.non-docs == 'true' runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -222,8 +248,8 @@ jobs: # all the benchmarking end-to-end integration tests for aztec (not required to merge) bench-e2e: - needs: [build, configure] - if: needs.build.outputs.bench_list != '[]' && ((needs.configure.outputs.non-docs == 'true' && needs.configure.outputs.non-barretenberg-cpp == 'true') || github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'bench')) + needs: [build, bench-test-gate, configure] + if: needs.build.outputs.bench_list != '[]' && needs.configure.outputs.non-docs == 'true' runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -264,9 +290,7 @@ jobs: acir-bench: runs-on: ubuntu-20.04 - needs: [build, configure] - # Note: not fully accurate, but to work with bench-summary needs to be the same as bench-e2e - if: needs.configure.outputs.non-barretenberg-cpp == 'true' + needs: [bench-test-gate, configure] steps: - uses: actions/checkout@v4 with: { ref: "${{ env.GIT_COMMIT }}" } @@ -598,7 +622,7 @@ jobs: yarn-project-formatting: needs: [build, configure] - if: needs.configure.outputs.yarn-project == 'true' || github.ref_name == 'master' + if: needs.configure.outputs.yarn-project == 'true' runs-on: ${{ needs.configure.outputs.username }}-x86 steps: - uses: actions/checkout@v4 @@ -612,7 +636,6 @@ jobs: yarn-project-test: needs: [build, configure] - if: needs.configure.outputs.yarn-project == 'true' || github.ref_name == 'master' runs-on: ${{ needs.configure.outputs.username }}-x86 steps: - uses: actions/checkout@v4 @@ -627,7 +650,6 @@ jobs: prover-client-test: needs: [build, configure] runs-on: ${{ needs.configure.outputs.username }}-x86 - if: needs.configure.outputs.yarn-project == 'true' || github.ref_name == 'master' steps: - uses: actions/checkout@v4 with: { ref: "${{ env.GIT_COMMIT }}" } @@ -638,16 +660,27 @@ jobs: timeout-minutes: 40 run: earthly-ci --no-output ./yarn-project/+prover-client-test - # proving disabled - network-test: - needs: [build, configure] - if: needs.configure.outputs.yarn-project == 'true' || github.ref_name == 'master' + network-transfer-test: + needs: [network-test-gate, configure] + runs-on: ${{ needs.configure.outputs.username }}-x86 + steps: + - uses: actions/checkout@v4 + with: { ref: "${{ env.GIT_COMMIT }}" } + - uses: ./.github/ci-setup-action + with: + concurrency_key: network-test-${{ matrix.test }} + - name: "Setup and Local Network Tests" + timeout-minutes: 60 + run: sudo shutdown -P 60 ; earthly-ci --no-output ./yarn-project/+network-test --test=./test-transfer.sh + + network-full-test: + needs: [network-test-gate, configure] runs-on: ${{ needs.configure.outputs.username }}-x86 strategy: max-parallel: 1 fail-fast: false matrix: - test: [test-transfer.sh, test-4epochs.sh] + test: [test-4epochs.sh] steps: - uses: actions/checkout@v4 with: { ref: "${{ env.GIT_COMMIT }}" } @@ -656,8 +689,6 @@ jobs: concurrency_key: network-test-${{ matrix.test }} - name: "Setup and Local Network Tests" timeout-minutes: 60 - # Only allow transfer test to run on every (non-network-all) PR - if: matrix.test == 'test-transfer.sh' || github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'network-all') run: sudo shutdown -P 60 ; earthly-ci --no-output ./yarn-project/+network-test --test=./${{ matrix.test }} kind-smoke-test: @@ -690,8 +721,7 @@ jobs: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u aztecprotocolci --password-stdin NAMESPACE=smoke FRESH_INSTALL=true VALUES_FILE=default.yaml ./scripts/network_test.sh ./src/spartan/smoke.test.ts - # note: proving disabled - kind-network-test: + kind-network-full-test: needs: [build, configure] if: contains(github.event.pull_request.labels.*.name, 'network-all') || (needs.configure.outputs.yarn-project == 'true' && github.ref_name == 'master') runs-on: ${{ needs.configure.outputs.username }}-x86 @@ -838,23 +868,8 @@ jobs: alert-comment-cc-users: "@ludamad @codygunton" max-items-in-chart: 50 - boxes: - needs: [build, configure] - runs-on: ${{ needs.configure.outputs.username }}-x86 - if: github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'boxes') || contains(github.event.pull_request.labels.*.name, 'e2e-all') - steps: - - uses: actions/checkout@v4 - with: { ref: "${{ github.event.pull_request.head.sha }}" } - - uses: ./.github/ci-setup-action - with: - concurrency_key: boxes - - name: Build - working-directory: ./boxes - timeout-minutes: 40 - run: earthly-ci +export-boxes - boxes-test: - needs: [boxes, configure] + needs: [e2e-test-gate, configure] runs-on: ${{ needs.configure.outputs.username }}-x86 strategy: fail-fast: false @@ -868,15 +883,18 @@ jobs: with: { ref: "${{ github.event.pull_request.head.sha }}" } - uses: ./.github/ci-setup-action with: - # must be globally unique for build x runner - concurrency_key: boxes-${{ needs.configure.outputs.username }}-x86-${{ matrix.box }}-${{ matrix.browser }} + concurrency_key: boxes-${{ matrix.box }}-${{ matrix.browser }} + - name: Build + working-directory: ./boxes + timeout-minutes: 40 + run: earthly-ci +export-boxes - name: Box test working-directory: ./boxes timeout-minutes: 40 run: earthly-ci -P --no-output +test --box=${{ matrix.box }} --browser=${{ matrix.browser }} --mode=cache rough-rhino-installer: - needs: [configure] + needs: [e2e-test-gate, configure] runs-on: ${{ needs.configure.outputs.username }}-x86 steps: - uses: actions/checkout@v4 @@ -890,7 +908,7 @@ jobs: protocol-circuits-gates-report: needs: [build, configure] - if: needs.configure.outputs.non-docs == 'true' && needs.configure.outputs.non-barretenberg-cpp == 'true' + if: needs.configure.outputs.non-docs == 'true' && needs.configure.outputs.non-misc-ci == 'true' runs-on: ${{ needs.configure.outputs.username }}-x86 permissions: pull-requests: write @@ -995,14 +1013,14 @@ jobs: - yarn-project-formatting - yarn-project-test - prover-client-test - - network-test + - network-transfer-test + - network-full-test # OK if skipped - kind-smoke-test - - kind-network-test + - kind-network-full-test # OK if skipped - l1-contracts-test - docs-preview # - bb-bench # non-blocking - - boxes - - boxes-test + - boxes-test # OK if skipped # - protocol-circuits-gates-report # non-blocking if: always() outputs: @@ -1044,7 +1062,7 @@ jobs: actions: write needs: - merge-check - if: github.event.pull_request.draft == false && !cancelled() + if: github.event.pull_request.draft == false && !cancelled() && !true steps: - name: Check for Rerun env: