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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: CI
on:
push:
branches:
pull_request:
jobs:
quality:
uses: WyattAu/engineering-standards/.github/workflows/rust-kit.yml@main
with:
tier: a
all-features: true
loom: false
wasm: false
miri: false
# criterion wall-clock benches: human-readable trend, non-gating.
# The pass/fail gate is the `perf-gate` job below (iai-callgrind,
# deterministic instruction counts).
bench-regression: true
# Deterministic perf gate: iai-callgrind instruction counts on the
# RateLimiter::check hot path (benches/iai_hot_path.rs).
#
# Baseline workflow: every push to main re-saves the `main` baseline and
# caches it; PRs compare against it with --fail-fast (first regression
# fails the job). Baseline updates are INTENTIONAL — after merging a
# deliberate perf change, the next main push refreshes the reference.
# Live Redis GCRA suite (tests/redis_gcra_live.rs): the Lua-script
# decision loop needs a real server — GitHub provides one as a service;
# locally, `docker run -p 6379:6379 redis:7` and run with `--ignored`.
integration:
name: Integration (live redis GCRA)
runs-on: ubuntu-latest
services:
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# The redis service covers the four quota tests; the fail-open test
# spins up its own throwaway container (docker preinstalled).
- name: live GCRA suite (fixture-gated)
run: cargo test --features redis --test redis_gcra_live -- --ignored --nocapture
env:
THROTTLE_KIT_REDIS_URL: redis://127.0.0.1:6379/
perf-gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install valgrind + iai-callgrind runner
# iai-callgrind shells out to valgrind (callgrind tool); recent
# ubuntu-latest runner images (202609xx) no longer ship it
# preinstalled, which failed the bench with "cannot find binary
# path: 'valgrind'".
run: |
sudo apt-get update && sudo apt-get install -y valgrind
cargo install iai-callgrind-runner --locked
- name: Restore main baseline
if: github.event_name == 'pull_request'
uses: actions/cache/restore@v4
with:
path: target/iai
key: iai-baseline-main-notused-${{ github.run_id }}
restore-keys: iai-baseline-main-
- name: Save baseline (push to main)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: cargo bench --bench iai_hot_path -- --save-baseline=main
- name: Regression gate (PRs)
if: github.event_name == 'pull_request'
run: cargo bench --bench iai_hot_path -- --baseline=main --fail-fast
- name: Save baseline cache (push to main)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/cache/save@v4
with:
path: target/iai
key: iai-baseline-main-${{ github.run_id }}