[bazel] Improve job reliability and ensure jobs are time-bound #10607
Workflow file for this run
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: C-Chain Re-Execution Benchmark GH Native | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| test: | |
| description: 'Test name (e.g., hashdb-101-250k, firewood-33m-33m500k). Leave empty for custom.' | |
| default: '' | |
| config: | |
| description: 'The config to pass to the VM for the benchmark. See BenchmarkReexecuteRange for details.' | |
| default: '' | |
| start-block: | |
| description: 'The start block for the benchmark.' | |
| default: '' | |
| end-block: | |
| description: 'The end block for the benchmark.' | |
| default: '' | |
| block-dir-src: | |
| description: 'The source block directory. Supports S3 directory/zip and local directories.' | |
| default: '' | |
| current-state-dir-src: | |
| description: 'The current state directory. Supports S3 directory/zip and local directories.' | |
| default: '' | |
| runner: | |
| description: 'Runner to execute the benchmark. Input to the runs-on field of the job.' | |
| required: true | |
| push-post-state: | |
| description: 'S3 location to push post-execution state directory. Skips this step if left unpopulated.' | |
| default: '' | |
| timeout-minutes: | |
| description: 'Timeout in minutes for the job.' | |
| default: '30' | |
| with-dependencies: | |
| description: 'Dependencies to use (e.g., "firewood=abc123" or "firewood=abc,libevm=xyz")' | |
| default: '' | |
| # Disabled because scheduled trigger is empty. To enable, uncomment and add at least one vector to the schedule | |
| # entry in the corresponding JSON file. | |
| # schedule: | |
| # - cron: '0 9 * * *' # Runs every day at 09:00 UTC (04:00 EST) | |
| jobs: | |
| define-matrix: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| matrix: ${{ steps.define-matrix.outputs.matrix }} | |
| has-aws-role: ${{ steps.check-aws-role.outputs.available }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Check AWS Role Availability | |
| id: check-aws-role | |
| run: echo "available=${{ secrets.AWS_S3_READ_ONLY_ROLE != '' }}" >> "$GITHUB_OUTPUT" | |
| - name: Define Matrix | |
| id: define-matrix | |
| shell: bash -x {0} | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| # Parse 'with-dependencies' input for dependency refs | |
| FIREWOOD_REF="" LIBEVM_REF="" | |
| [[ "${{ github.event.inputs.with-dependencies }}" =~ firewood=([^,]+) ]] && FIREWOOD_REF="${BASH_REMATCH[1]}" | |
| [[ "${{ github.event.inputs.with-dependencies }}" =~ libevm=([^,]+) ]] && LIBEVM_REF="${BASH_REMATCH[1]}" | |
| { | |
| echo "matrix<<EOF" | |
| printf '{ "include": [{ "test": "%s", "start-block": "%s", "end-block": "%s", "block-dir-src": "%s", "current-state-dir-src": "%s", "config": "%s", "runner": "%s", "timeout-minutes": %s, "firewood-ref": "%s", "libevm-ref": "%s" }] }\n' \ | |
| "${{ github.event.inputs.test }}" \ | |
| "${{ github.event.inputs.start-block }}" \ | |
| "${{ github.event.inputs.end-block }}" \ | |
| "${{ github.event.inputs.block-dir-src }}" \ | |
| "${{ github.event.inputs.current-state-dir-src }}" \ | |
| "${{ github.event.inputs.config }}" \ | |
| "${{ github.event.inputs.runner }}" \ | |
| "${{ github.event.inputs.timeout-minutes }}" \ | |
| "$FIREWOOD_REF" \ | |
| "$LIBEVM_REF" | |
| echo EOF | |
| } >> "$GITHUB_OUTPUT" | |
| else | |
| json_string=$(jq -r ".\"${{ github.event_name }}\"" .github/workflows/c-chain-reexecution-benchmark-gh-native.json) | |
| { | |
| echo "matrix<<EOF" | |
| echo "$json_string" | |
| echo EOF | |
| } >> "$GITHUB_OUTPUT" | |
| fi | |
| c-chain-reexecution: | |
| needs: define-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix) }} | |
| timeout-minutes: ${{ matrix.timeout-minutes }} | |
| # Fork PRs and Dependabot PRs are served by secret stores without this role, so | |
| # authenticating to S3 would fail before the benchmark starts. | |
| if: ${{ needs.define-matrix.outputs.has-aws-role == 'true' }} | |
| permissions: | |
| id-token: write | |
| contents: write | |
| runs-on: ${{ matrix.runner }} | |
| defaults: | |
| run: | |
| shell: nix develop --command bash -x {0} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # Nix is required before calling polyrepo. | |
| # c-chain-reexecution-benchmark's Nix install will be skipped; installation is idempotent. | |
| - name: Install Nix | |
| if: matrix.libevm-ref != '' || matrix.firewood-ref != '' | |
| uses: ./.github/actions/install-nix | |
| - name: Configure dependency versions | |
| if: matrix.libevm-ref != '' || matrix.firewood-ref != '' | |
| run: ./scripts/run_task.sh run-polyrepo | |
| env: | |
| LIBEVM_REF: ${{ matrix.libevm-ref }} | |
| FIREWOOD_REF: ${{ matrix.firewood-ref }} | |
| - name: Run C-Chain Re-Execution Benchmark | |
| uses: ./.github/actions/c-chain-reexecution-benchmark | |
| with: | |
| test: ${{ matrix.test }} | |
| config: ${{ matrix.config }} | |
| start-block: ${{ matrix.start-block }} | |
| end-block: ${{ matrix.end-block }} | |
| block-dir-src: ${{ matrix.block-dir-src }} | |
| current-state-dir-src: ${{ matrix.current-state-dir-src }} | |
| prometheus-url: ${{ secrets.PROMETHEUS_URL || '' }} | |
| prometheus-push-url: ${{ secrets.PROMETHEUS_PUSH_URL || '' }} | |
| prometheus-username: ${{ secrets.PROMETHEUS_USERNAME || '' }} | |
| prometheus-password: ${{ secrets.PROMETHEUS_PASSWORD || '' }} | |
| push-github-action-benchmark: ${{ github.event_name == 'schedule' }} | |
| skip-benchmark-comparison: ${{ matrix.firewood-ref != '' || matrix.libevm-ref != '' }} | |
| aws-role: ${{ github.event.inputs.push-post-state != '' && secrets.AWS_S3_RW_ROLE || secrets.AWS_S3_READ_ONLY_ROLE }} | |
| aws-region: 'us-east-2' | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| push-post-state: ${{ github.event.inputs.push-post-state }} | |
| runner_type: ${{ matrix.runner }} |