1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Benchmarks
on:
workflow_dispatch:
jobs:
bench:
name: Run criterion benchmarks
# ubuntu-latest-4-cores gives a dedicated 4-core instance which reduces
# run-to-run variance compared to the shared 2-core ubuntu-latest runners.
# The alert threshold is kept at 130 % to absorb remaining CI noise.
runs-on: ubuntu-latest-4-cores
timeout-minutes: 60
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-bench-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-bench-
# Required by the `*_laravel_framework` benches in requests/index/
# semantic — they skip silently if the fixture is missing, so
# without this step CI would under-report coverage on salsa's
# cross-file paths (the ones most likely to regress).
- name: Set up Laravel fixture
run: bash scripts/setup_laravel_fixture.sh
- name: Run benchmarks
run: cargo bench -- --output-format bencher | tee output.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1.22.0
with:
tool: cargo
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
# Alert threshold accounts for natural variance on shared CI runners (~15-30%).
# 130% flags only genuine regressions and avoids constant noise.
alert-threshold: "130%"
comment-on-alert: true
fail-on-alert: true
# Push results to gh-pages branch to track history.
auto-push: ${{ github.ref == 'refs/heads/main' }}
- name: Upload criterion HTML reports
uses: actions/upload-artifact@v7
with:
name: criterion-${{ github.sha }}
path: target/criterion/
retention-days: 90