Skip to content

Commit a19e76d

Browse files
committed
ci(bench): add weekly-cron + manual-dispatch criterion workflow
WHY: slice 4 of T1 test-architecture decomposition. Runs `cargo bench -p perima-hash -p perima-db` on Mondays 07:00 UTC (1h after slice 3 cargo-fuzz to avoid runner-pool contention) + on-demand via workflow_dispatch (with optional sample_size input). Linux-only (perf is OS-variant; cross-OS comparison would mislead). Single job (no matrix — both benches share a compile cache). Bench step is `continue-on-error: true` (observability-only) — any non-zero exit doesn't block the workflow; results are tee'd to \$GITHUB_STEP_SUMMARY so the workflow run page shows the latest numbers. target/criterion/ HTML reports upload as `criterion-reports` artifact for deep-dive analysis. NO threshold gate, NO PR-blocking, NO baseline-comparison infrastructure (per spec D-4 + Batch J GH #135 flake-risk precedent).
1 parent 7a474fd commit a19e76d

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

.github/workflows/bench.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# criterion benchmarks weekly cron + manual workflow_dispatch.
2+
# Slice 4 of T1 test-architecture decomposition.
3+
# See spec: docs/superpowers/specs/2026-04-25-criterion-benches-design.md
4+
#
5+
# WHY a separate workflow (not added to ci.yml): criterion runs are
6+
# bounded MINUTES, not seconds; per-PR queue cost is disproportionate.
7+
# Decoupling lets bench fail-or-skip independently of the main matrix.
8+
9+
name: bench
10+
11+
on:
12+
schedule:
13+
- cron: '0 7 * * 1' # Mondays 07:00 UTC (1h after slice 3 cargo-fuzz)
14+
workflow_dispatch:
15+
inputs:
16+
sample_size:
17+
description: 'criterion sample size per benchmark'
18+
type: string
19+
default: '30'
20+
21+
permissions:
22+
contents: read
23+
24+
env:
25+
CARGO_TERM_COLOR: always
26+
27+
jobs:
28+
bench:
29+
name: cargo bench
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- uses: dtolnay/rust-toolchain@stable
35+
- uses: Swatinem/rust-cache@v2
36+
37+
# WHY GTK deps even though no benched crate uses them: matches
38+
# slice 1/3 workflow-scaffolding pattern. perima-hash + perima-db
39+
# don't transitively need GTK; the install is defensive.
40+
- name: Install image/system deps
41+
run: |
42+
sudo apt-get update -q
43+
sudo apt-get install -yq \
44+
libgtk-3-dev \
45+
libwebkit2gtk-4.1-dev \
46+
libayatana-appindicator3-dev \
47+
librsvg2-dev \
48+
patchelf
49+
50+
# WHY continue-on-error: per spec D-4, observability-only mode.
51+
# Bench step might fail on transient runner issues; swallowing
52+
# the exit lets artifact upload still run. Consistent posture
53+
# with slice 1/3 workflows.
54+
#
55+
# WHY scoped to `-p perima-hash -p perima-db` (NOT --workspace):
56+
# this slice pins exactly 2 benched crates. `cargo bench --workspace`
57+
# would compile + invoke benches in any future workspace crate that
58+
# gets a [[bench]] entry, scope-creeping the slice's contract.
59+
- name: Run cargo bench (perima-hash + perima-db)
60+
continue-on-error: true
61+
env:
62+
SAMPLE_SIZE: ${{ github.event.inputs.sample_size || '30' }}
63+
run: |
64+
# Tee bench output to GITHUB_STEP_SUMMARY so the run page shows
65+
# the latest numbers without artifact download.
66+
{
67+
echo "## criterion benchmark results"
68+
echo ""
69+
echo '```'
70+
cargo bench -p perima-hash -p perima-db -- --sample-size "$SAMPLE_SIZE" 2>&1
71+
echo '```'
72+
} | tee -a "$GITHUB_STEP_SUMMARY"
73+
74+
- name: Upload criterion target dir (raw HTML reports)
75+
if: always()
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: criterion-reports
79+
path: target/criterion/
80+
if-no-files-found: ignore

0 commit comments

Comments
 (0)