Skip to content

Commit fec2908

Browse files
committed
Add CI workflow for running benchmarks
1 parent 7806052 commit fec2908

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/benchmarks.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Continuous Benchmarking
2+
3+
# This workflow runs on pushes to the main branch and on pull requests that target the main branch.
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
16+
jobs:
17+
benchmark:
18+
name: Run Benchmarks
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout Code
22+
uses: actions/checkout@v4
23+
24+
- name: Install Rust
25+
uses: dtolnay/rust-toolchain@stable
26+
27+
- name: Run Full Benchmark Suite (on main)
28+
if: github.event_name == 'push'
29+
run: cargo bench -- --nocapture > output.txt
30+
31+
- name: Run Lighter Benchmark Suite (on PR)
32+
if: github.event_name == 'pull_request'
33+
run: |
34+
# We run cargo bench multiple times, filtering for each of your desired fast benchmarks.
35+
# The output of each command is appended (>>) to the same output file.
36+
cargo bench -- "Zip/EncodeRows: Int<4>, poly_size = 2^12" -- --nocapture > output.txt
37+
cargo bench -- "Zip/EncodeMessage: Int<4>, row_len = 128" -- --nocapture >> output.txt
38+
cargo bench -- "Zip/MerkleRoot: Int<1>, leaves=2^12" -- --nocapture >> output.txt
39+
cargo bench -- "Zip/Commit: Int<4>, poly_size = 2^12" -- --nocapture >> output.txt
40+
cargo bench -- "Zip/Open: RandomField<4>, poly_size = 2^12" -- --nocapture >> output.txt
41+
cargo bench -- "Zip/Verify: RandomField<4>, poly_size = 2^12" -- --nocapture >> output.txt
42+
43+
- name: Store and Analyze Benchmark Results
44+
uses: benchmark-action/github-action-benchmark@v1.20.4
45+
with:
46+
tool: 'cargo'
47+
output-file-path: 'output.txt'
48+
github-token: ${{ secrets.GITHUB_TOKEN }}
49+
comment-on-alert: true # Post a comment on PRs for regressions.
50+
alert-on-commit: true # Create an alert for every commit on the main branch.

0 commit comments

Comments
 (0)