ci: matrix-test serial vs parallel exec across the test workflows #587
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Benchmarks | |
| on: | |
| workflow_dispatch: | |
| workflow_call: | |
| inputs: | |
| cache-warming-only: | |
| description: "Compile test binaries only; skip test execution (for cache warming runs)" | |
| type: boolean | |
| default: false | |
| # Auto-fire on PRs that touch this workflow's own YAML so the exec-mode | |
| # matrix change can be validated in-PR without a manual dispatch. | |
| # Regular PRs that don't touch this file are unaffected — bench is | |
| # otherwise dispatch-only because it needs stable conditions. | |
| pull_request: | |
| paths: | |
| - '.github/workflows/test-bench.yml' | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| benchmarks: | |
| name: benchmarks (${{ matrix.exec_mode }}) | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Each entry runs on its own GitHub-hosted runner — wall-clock | |
| # unchanged, runner-minutes doubled. Bench numbers are reported | |
| # per matrix entry so serial vs parallel can be compared directly. | |
| exec_mode: | |
| - serial | |
| - parallel | |
| env: | |
| # Toggle dbg.Exec3Parallel from CI without code changes. envLookup | |
| # in common/dbg/dbg_env.go auto-prepends ERIGON_, so this maps to | |
| # the EXEC3_PARALLEL flag declared in common/dbg/experiments.go. | |
| ERIGON_EXEC3_PARALLEL: ${{ matrix.exec_mode == 'parallel' && 'true' || 'false' }} | |
| steps: | |
| - name: Checkout custom actions | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| # No submodules or LFS needed: benchmark functions only use | |
| # in-memory or local testdata/ files. Space cleanup is needed | |
| # for the cache-warming path (go test -run=^$ ./...) which | |
| # compiles test binaries for every package. | |
| - uses: ./.github/actions/setup-erigon | |
| id: erigon | |
| with: | |
| cleanup-space: true | |
| - name: Run benchmarks | |
| if: '!inputs.cache-warming-only' | |
| run: make test-bench | |
| - name: Build test binaries (cache warming) | |
| if: inputs.cache-warming-only | |
| run: go test -run=^$ ./... | |
| - uses: ./.github/actions/cleanup-erigon | |
| if: always() | |
| # In the merge queue, cancel the run on first failure so the gate | |
| # doesn't stall waiting for still-running siblings. PR runs keep | |
| # going so authors see the full failure picture. | |
| - name: Cancel workflow run on failure | |
| if: failure() && github.event_name == 'merge_group' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh run cancel ${{ github.run_id }} || true |