Fix bench ci #28
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: PR Benchmarks | |
| on: | |
| pull_request: | |
| types: [opened, reopened, edited, synchronize] | |
| paths: | |
| - "src/**" | |
| - "benches/**" | |
| - "Cargo.toml" | |
| - "Cargo.lock" | |
| # If new code is pushed to a PR branch, then cancel in progress workflows for | |
| # that PR. Ensures that we don't waste CI time, and returns results quicker. | |
| # https://github.com/jonhoo/rust-ci-conf/pull/5 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| benchmark: | |
| name: "Continuous PR Benchmarking: ${{ matrix.suite }}" | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| suite: | |
| - historic_scanning | |
| - latest_events_scanning | |
| steps: | |
| - name: Harden runner | |
| uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2 | |
| - name: Setup Foundry | |
| uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # v1.6.0 | |
| - name: Setup Bencher | |
| # Official docs recommend using `main` commit, because discrepancies between CI version and Bencher's API version | |
| # can cause bench failures. | |
| # https://bencher.dev/docs/how-to/github-actions/ | |
| uses: bencherdev/bencher@main | |
| - name: Prepare benchmark state | |
| run: | | |
| gunzip -kf benches/dumps/*.json.gz | |
| ls -lh benches/dumps/ | |
| - name: Run benchmark | |
| env: | |
| BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} | |
| BENCHER_PROJECT: ${{ vars.BENCHER_PROJECT }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| bencher run \ | |
| --project "$BENCHER_PROJECT" \ | |
| --token "$BENCHER_API_TOKEN" \ | |
| --branch "${{ github.head_ref || github.ref_name }}" \ | |
| --testbed ubuntu-latest \ | |
| --adapter rust_criterion \ | |
| --start-point "${{ github.base_ref }}" \ | |
| --start-point-hash "${{ github.event.pull_request.base.sha }}" \ | |
| --start-point-clone-thresholds \ | |
| --start-point-reset \ | |
| --github-actions "$GITHUB_TOKEN" \ | |
| --err \ | |
| "cargo bench --bench ${{ matrix.suite }} --features bench-utils" |