|
| 1 | +name: PR Benchmarks |
| 2 | + |
| 3 | +# TODO: re-enable once we have a valid Bencher API token |
| 4 | +# on: |
| 5 | +# pull_request: |
| 6 | +# types: [opened, reopened, edited, synchronize] |
| 7 | + |
| 8 | +env: |
| 9 | + CARGO_TERM_COLOR: always |
| 10 | + RUST_BACKTRACE: 1 |
| 11 | + |
| 12 | +jobs: |
| 13 | + benchmark: |
| 14 | + name: "Continuous PR Benchmarking: ${{ matrix.suite }}" |
| 15 | + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository |
| 16 | + runs-on: ubuntu-latest |
| 17 | + permissions: |
| 18 | + checks: write |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + suite: |
| 23 | + - historic_scanning |
| 24 | + - latest_events_scanning |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Harden runner |
| 28 | + uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 |
| 29 | + with: |
| 30 | + egress-policy: audit |
| 31 | + |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 34 | + |
| 35 | + - name: Setup Rust |
| 36 | + uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2 |
| 37 | + |
| 38 | + - name: Setup Foundry |
| 39 | + uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # v1.6.0 |
| 40 | + |
| 41 | + - name: Setup Bencher |
| 42 | + uses: bencherdev/bencher@2f1532643adc0e69e52acaec936d227ff14da24f # v0.5.9 |
| 43 | + |
| 44 | + - name: Prepare benchmark state |
| 45 | + run: | |
| 46 | + gunzip -kf benches/dumps/*.json.gz |
| 47 | + ls -lh benches/dumps/ |
| 48 | +
|
| 49 | + - name: Run benchmark |
| 50 | + env: |
| 51 | + BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} |
| 52 | + BENCHER_PROJECT: ${{ vars.BENCHER_PROJECT }} |
| 53 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + run: | |
| 55 | + bencher run \ |
| 56 | + --project "$BENCHER_PROJECT" \ |
| 57 | + --token "$BENCHER_API_TOKEN" \ |
| 58 | + --branch "${{ github.head_ref || github.ref_name }}" \ |
| 59 | + --testbed ubuntu-latest \ |
| 60 | + --adapter rust_criterion \ |
| 61 | + --start-point "${{ github.base_ref }}" \ |
| 62 | + --start-point-hash "${{ github.event.pull_request.base.sha }}" \ |
| 63 | + --start-point-clone-thresholds \ |
| 64 | + --start-point-reset \ |
| 65 | + --github-actions "$GITHUB_TOKEN" \ |
| 66 | + --err \ |
| 67 | + "cargo bench --bench ${{ matrix.suite }} --features bench-utils" |
0 commit comments