Skip to content

Commit 2e1aca2

Browse files
committed
split main & pr benches + update Pr benches to run as per docs
1 parent 746fda4 commit 2e1aca2

File tree

2 files changed

+81
-21
lines changed

2 files changed

+81
-21
lines changed
Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
1-
name: Benchmarks
1+
name: Base Benchmarks
22

3-
on:
4-
push:
5-
branches: [main]
6-
paths:
7-
- "src/**"
8-
- "benches/**"
9-
- "Cargo.toml"
10-
- "Cargo.lock"
11-
pull_request:
12-
paths:
13-
- "src/**"
14-
- "benches/**"
15-
- "Cargo.toml"
16-
- "Cargo.lock"
17-
18-
permissions:
19-
contents: read
20-
checks: write
3+
# TODO: re-enable once we have a valid Bencher
4+
# on:
5+
# push:
6+
# branches: main
7+
# paths:
8+
# - "src/**"
9+
# - "benches/**"
10+
# - "Cargo.toml"
11+
# - "Cargo.lock"
2112

2213
env:
2314
CARGO_TERM_COLOR: always
2415
RUST_BACKTRACE: 1
2516

2617
jobs:
2718
benchmark:
28-
name: "${{ matrix.suite }}"
19+
name: "Continuous Benchmarking: ${{ matrix.suite }}"
2920
runs-on: ubuntu-latest
21+
permissions:
22+
checks: write
3023
strategy:
3124
fail-fast: false
3225
matrix:
@@ -66,7 +59,7 @@ jobs:
6659
bencher run \
6760
--project "$BENCHER_PROJECT" \
6861
--token "$BENCHER_API_TOKEN" \
69-
--branch "${{ github.head_ref || github.ref_name }}" \
62+
--branch main \
7063
--testbed ubuntu-latest \
7164
--adapter rust_criterion \
7265
--threshold-measure latency \
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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

Comments
 (0)