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
88
89
name: CI
# Run on branch pushes and PRs only; exclude tag pushes (tagged commits are already green).
# Per GitHub docs: when using tags-ignore we must explicitly specify branches to trigger on.
on:
push:
tags-ignore:
- '**'
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install protoc (build.rs requires it for gRPC and remote-write protos)
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends protobuf-compiler
- name: Unit + integration tests
run: cargo test
microbench:
runs-on: ubuntu-latest
needs: test
# Serialize runs on main to avoid cache save conflicts; also prevents two
# merges in quick succession from both trying to reserve the same key.
concurrency:
group: microbench-${{ github.ref }}
cancel-in-progress: false
env:
# Regression thresholds: tune for your CI runner if needed.
#
# These are intentionally conservative to avoid flaky failures while still catching
# meaningful regressions.
UGNOS_MICROBENCH_POINTS: "50000"
UGNOS_MIN_INGEST_PTS_PER_SEC: "20000"
UGNOS_MAX_FLUSH_MS: "2000"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install protoc (build.rs requires it for gRPC and remote-write protos)
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends protobuf-compiler
# On main we only save (no restore), so we never save the same key we restored.
# On branches/PRs we restore to compare against baseline.
- name: Restore iai-callgrind baseline (for comparison / N/A avoidance)
if: github.ref != 'refs/heads/main'
id: restore-iai
uses: actions/cache/restore@v4
with:
path: target/iai
# Key chosen so exact match never hits (we save iai-baseline-v1-<sha>);
# restore-keys fetches the latest main baseline for comparison.
key: iai-baseline-v1-
restore-keys: iai-baseline-v1-
- name: Run microbench regression gates (release)
run: cargo test --release --test microbench_regressions -- --ignored
- name: Install Valgrind (for iai-callgrind microbench suite)
run: sudo apt-get update && sudo apt-get install -y valgrind
- name: Install iai-callgrind-runner (for iai-callgrind microbench suite)
run: cargo install --locked --version 0.16.1 iai-callgrind-runner
# On main: run benchmarks and save as baseline. On other branches: run benchmarks
# and compare to cached baseline. Do NOT use --load-baseline on branches: that
# makes the runner skip execution and use the cached data as "current" (see dev/MICROBENCH_IAI_CI.md).
- name: Run deterministic microbench suite (iai-callgrind)
run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
cargo bench --bench microbench_iai -- --save-baseline=default
elif [ -n "${{ steps.restore-iai.outputs.cache-matched-key }}" ]; then
cargo bench --bench microbench_iai -- --baseline=default
else
echo "::warning::No cached baseline (new repo or cache evicted); running with --save-baseline (no comparison). Push to main to establish baseline."
cargo bench --bench microbench_iai -- --save-baseline=default
fi
- name: Save iai-callgrind baseline (main only, on success)
if: success() && github.ref == 'refs/heads/main'
uses: actions/cache/save@v4
with:
path: target/iai
# Unique key per commit: eliminates "another job may be creating this cache"
# conflict when multiple main pushes (e.g. merges) run close together.
# Restore uses restore-keys prefix to get the latest saved baseline.
key: iai-baseline-v1-${{ github.sha }}