-
Notifications
You must be signed in to change notification settings - Fork 15
111 lines (94 loc) · 3.67 KB
/
Copy pathperf-canary.yml
File metadata and controls
111 lines (94 loc) · 3.67 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Perf Canary
# Lightweight per-PR build-time regression gate for PRs that touch the
# extractor, graph-builder, or native Rust layers — the parts of the codebase
# that caused the v3.12.0 regressions (+1827% 1-file rebuild, +98% full build).
#
# Only the incremental-benchmark suite is run (full build + no-op + 1-file
# rebuild for both engines). The regression guard uses BENCH_CANARY=1 mode,
# which applies a 50% threshold instead of the full suite's 25% — enough
# to catch catastrophic regressions while tolerating CI runner variance.
#
# This is intentionally separate from the full pre-publish-benchmark job in
# ci.yml, which runs unconditionally on every PR and measures the complete
# suite. The canary completes in roughly 5–10 minutes; the full suite takes
# 20–60 minutes.
on:
pull_request:
paths:
- "src/extractors/**"
- "src/domain/graph/**"
- "crates/**"
- "scripts/benchmark.ts"
- "scripts/incremental-benchmark.ts"
- "scripts/lib/bench-config.ts"
- "scripts/lib/fork-engine.ts"
concurrency:
group: perf-canary-${{ github.ref }}
cancel-in-progress: true
jobs:
perf-canary:
name: Perf canary (incremental tiers)
runs-on: ubuntu-latest
env:
CODEGRAPH_FAST_SKIP_DIAG: "1"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: "22"
cache: "npm"
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: crates/codegraph-core
- name: Install napi-rs CLI
timeout-minutes: 5
run: npm install -g @napi-rs/cli@3
- name: Build native addon
working-directory: crates/codegraph-core
run: napi build --release
- name: Install dependencies
timeout-minutes: 20
shell: bash
run: |
for attempt in 1 2 3; do
npm install && break
if [ "$attempt" -lt 3 ]; then
echo "::warning::npm install attempt $attempt failed, retrying in 15s..."
sleep 15
else
echo "::error::npm install failed after 3 attempts"
exit 1
fi
done
- name: Install native addon over published binary
run: node scripts/ci-install-native.mjs
# Build dist/ so benchmarks load the same compiled JS that ships to npm,
# matching the methodology used by the full pre-publish-benchmark gate.
- name: Build TypeScript
run: npm run build
- name: Run incremental benchmark
timeout-minutes: 15
run: |
STRIP_FLAG=$(node -e "const [M]=process.versions.node.split('.').map(Number); console.log(M>=23?'--strip-types':'--experimental-strip-types')")
node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/incremental-benchmark.ts --version dev --dist > incremental-canary-result.json
- name: Update incremental report
run: |
STRIP_FLAG=$(node -e "const [M]=process.versions.node.split('.').map(Number); console.log(M>=23?'--strip-types':'--experimental-strip-types')")
node $STRIP_FLAG scripts/update-incremental-report.ts incremental-canary-result.json
- name: Regression guard (50% threshold)
env:
RUN_REGRESSION_GUARD: "1"
BENCH_CANARY: "1"
run: npm run test:regression-guard
- name: Upload canary result
if: always()
uses: actions/upload-artifact@v7
with:
name: incremental-canary-result
path: incremental-canary-result.json
if-no-files-found: warn