From d5125cb2029e2088f04c7477f48b146382af1dfb Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Thu, 3 Dec 2026 10:08:27 +0000 Subject: [PATCH 1/2] ci: Run the production SVM test beside the validator tests The verified-build job ran the validator tests (about 9 minutes) and then the production-binary test (about 4) one after the other, which made it the slowest job at about 15 minutes. The production test builds its own binaries and shares nothing with the test-feature build, so it now has a job of its own and the two run in parallel. Both jobs take the SVM path filter from one new job, so that the list of paths is still written once. Also cancel a pull request's run when a newer push supersedes it. Pushes to master are not grouped, and each runs to completion. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Paul <108695806+pxrl@users.noreply.github.com> --- .github/workflows/pr.yml | 100 +++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 26 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 029fb38eb..d0fbbac90 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -4,9 +4,44 @@ on: push: branches: - "master" +# A new push to a pull request supersedes the run of the push before it. Pushes to master are never grouped, so +# each of those runs to completion. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true env: NODE_VERSION: "22.23.4" jobs: + # The SVM test jobs run their tests only when something they depend on changed. + svm-changes: + name: Detect SVM changes + runs-on: ubuntu-latest + outputs: + svm: ${{ steps.filter.outputs.svm }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Check which paths changed + uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + svm: + - 'Anchor.toml' + - 'verified-build.json' + - 'Cargo.toml' + - 'Cargo.lock' + - 'package.json' + - 'yarn.lock' + - '.github/actions/setup-solana-anchor/**' + - '.github/workflows/pr.yml' + - 'programs/**' + - 'idls/**' + - 'scripts/svm/**' + - 'src/svm/**' + - 'test/svm/**' + - 'test/svm-gateway/**' + - 'test/svm-production/**' # Multiple jobs depend on having EVM and SVM artifacts available, so we upload them first in separate jobs. upload-svm-artifacts: name: Upload SVM artifacts @@ -121,7 +156,9 @@ jobs: fi test-svm-verified: name: Test verified SVM build - needs: upload-svm-artifacts + needs: + - upload-svm-artifacts + - svm-changes runs-on: ubuntu-latest steps: - name: Checkout repo @@ -137,27 +174,6 @@ jobs: uses: ./.github/actions/setup-solana-anchor with: node_version: ${{ env.NODE_VERSION }} - - name: Check which paths changed - uses: dorny/paths-filter@v3 - id: filter - with: - filters: | - svm: - - 'Anchor.toml' - - 'verified-build.json' - - 'Cargo.toml' - - 'Cargo.lock' - - 'package.json' - - 'yarn.lock' - - '.github/actions/setup-solana-anchor/**' - - '.github/workflows/pr.yml' - - 'programs/**' - - 'idls/**' - - 'scripts/svm/**' - - 'src/svm/**' - - 'test/svm/**' - - 'test/svm-gateway/**' - - 'test/svm-production/**' - name: Download SVM artifacts uses: actions/download-artifact@v4 with: @@ -181,18 +197,50 @@ jobs: env: IS_TEST: true run: yarn build-svm-solana-verify - # Docker may create deploy/ as root. The later production build must be able to remove stale test binaries. + # Docker may create deploy/ as root. - name: Restore verified artifact ownership - if: steps.filter.outputs.svm == 'true' + if: needs.svm-changes.outputs.svm == 'true' run: sudo chown -R "$(id -u):$(id -g)" target/deploy - name: Archive verified test build (for caching) if: steps.verified-test-build-cache.outputs.cache-hit != 'true' run: tar -cf svm-verified-test-binaries.tar target/deploy - name: Test verified SVM build - if: steps.filter.outputs.svm == 'true' + if: needs.svm-changes.outputs.svm == 'true' run: anchor test --skip-build --validator legacy + # A job of its own, so that it runs beside the validator tests above and not after them. It builds the production + # binaries itself, and shares nothing with that job's test-feature build. + test-svm-production: + name: Test production SVM binary + needs: + - upload-svm-artifacts + - svm-changes + runs-on: ubuntu-latest + steps: + - name: Checkout repo + if: needs.svm-changes.outputs.svm == 'true' + uses: actions/checkout@v3 + - name: "Use Node ${{ env.NODE_VERSION }}" + if: needs.svm-changes.outputs.svm == 'true' + uses: actions/setup-node@v3 + with: + node-version: "${{ env.NODE_VERSION }}" + cache: yarn + - name: Install packages + if: needs.svm-changes.outputs.svm == 'true' + run: yarn install --frozen-lockfile --ignore-optional + - name: Setup Anchor & Solana + if: needs.svm-changes.outputs.svm == 'true' + uses: ./.github/actions/setup-solana-anchor + with: + node_version: ${{ env.NODE_VERSION }} + # As in the job above, the generated IDLs and types are in place before the Docker build writes to target/. + - name: Download SVM artifacts + if: needs.svm-changes.outputs.svm == 'true' + uses: actions/download-artifact@v4 + with: + name: svm-artifacts-${{ runner.os }}-node-${{ env.NODE_VERSION }} - name: Test verified production binary in a fresh ledger - if: steps.filter.outputs.svm == 'true' + if: needs.svm-changes.outputs.svm == 'true' run: yarn test-svm-production build-ts: name: Build TypeScript From 204d4f3b0c19580bbd8773ce8880c95fb6ef092f Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Thu, 3 Dec 2026 11:13:38 +0000 Subject: [PATCH 2/2] ci: Skip the production SVM job as a whole when SVM is unchanged Co-Authored-By: Claude Fable 5.2 Signed-off-by: Paul <108695806+pxrl@users.noreply.github.com> --- .github/workflows/pr.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d0fbbac90..2f869d99c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -197,7 +197,7 @@ jobs: env: IS_TEST: true run: yarn build-svm-solana-verify - # Docker may create deploy/ as root. + # Docker may create deploy/ as root, and the tests below run as the runner's user. - name: Restore verified artifact ownership if: needs.svm-changes.outputs.svm == 'true' run: sudo chown -R "$(id -u):$(id -g)" target/deploy @@ -214,33 +214,29 @@ jobs: needs: - upload-svm-artifacts - svm-changes + # Nothing here has to run when the SVM paths are unchanged, so the whole job is skipped. + if: needs.svm-changes.outputs.svm == 'true' runs-on: ubuntu-latest steps: - name: Checkout repo - if: needs.svm-changes.outputs.svm == 'true' uses: actions/checkout@v3 - name: "Use Node ${{ env.NODE_VERSION }}" - if: needs.svm-changes.outputs.svm == 'true' uses: actions/setup-node@v3 with: node-version: "${{ env.NODE_VERSION }}" cache: yarn - name: Install packages - if: needs.svm-changes.outputs.svm == 'true' run: yarn install --frozen-lockfile --ignore-optional - name: Setup Anchor & Solana - if: needs.svm-changes.outputs.svm == 'true' uses: ./.github/actions/setup-solana-anchor with: node_version: ${{ env.NODE_VERSION }} # As in the job above, the generated IDLs and types are in place before the Docker build writes to target/. - name: Download SVM artifacts - if: needs.svm-changes.outputs.svm == 'true' uses: actions/download-artifact@v4 with: name: svm-artifacts-${{ runner.os }}-node-${{ env.NODE_VERSION }} - name: Test verified production binary in a fresh ledger - if: needs.svm-changes.outputs.svm == 'true' run: yarn test-svm-production build-ts: name: Build TypeScript