Repository navigation
375 lines (320 loc) · 12.5 KB
/
Copy pathci.yml
File metadata and controls
375 lines (320 loc) · 12.5 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: "1"
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: sccache
jobs:
workspace-version:
name: Workspace Version
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master 2026-09-12
with:
toolchain: 1.98.0
- name: Require the version gate's parser
run: command -v jq >/dev/null 2>&1 || { echo "jq is required"; exit 1; }
# This is deliberately the workflow's first Cargo subprocess. Every
# Cargo-running job below depends on this job.
- name: Verify workspace version surfaces
run: bash scripts/check-workspace-versions.sh
linux:
name: Linux
needs: workspace-version
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master 2026-09-12
with:
toolchain: 1.98.0
components: rustfmt,clippy
- name: Verify workspace version surfaces before Cargo/cache
run: bash scripts/check-workspace-versions.sh
- name: Cache Rust inputs
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
shared-key: cargo-home-${{ runner.os }}-${{ runner.arch }}
cache-targets: false
- name: Configure compiler cache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
with:
version: "v0.16.0"
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
- name: Install pinned repository tools
run: npm install --global oxfmt@0.64.0
- name: Install pinned actionlint
run: bash .github/scripts/install-actionlint.sh
- name: Require fixture parsers and shell linter
run: |
set -euo pipefail
command -v shellcheck >/dev/null 2>&1 || { echo "shellcheck is required"; exit 1; }
python3 -c 'import yaml' \
|| python3 -m pip install --break-system-packages PyYAML==6.0.3 \
|| python3 -m pip install PyYAML==6.0.3
- name: Run the complete local gate
run: make check
windows-clippy:
name: Windows Clippy
needs: workspace-version
runs-on: windows-2025
timeout-minutes: 35
env:
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_PROFILE_TEST_SPLIT_DEBUGINFO: off
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master 2026-09-12
with:
toolchain: 1.98.0
components: clippy
- name: Verify workspace version surfaces before Cargo/cache
shell: bash
run: bash scripts/check-workspace-versions.sh
- name: Cache Rust inputs
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
shared-key: cargo-home-${{ runner.os }}-${{ runner.arch }}
cache-targets: false
- name: Configure compiler cache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
with:
version: "v0.16.0"
- name: Clippy
run: cargo clippy --workspace --exclude codegraph-bench --all-targets --locked -- -D warnings
windows-test:
name: Windows Tests
needs: workspace-version
runs-on: windows-2025
timeout-minutes: 40
env:
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_PROFILE_TEST_SPLIT_DEBUGINFO: off
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master 2026-09-12
with:
toolchain: 1.98.0
- name: Verify workspace version surfaces before Cargo/cache
shell: bash
run: bash scripts/check-workspace-versions.sh
- name: Parse the PowerShell installer
shell: pwsh
run: |
$tokens = $null
$errors = $null
[System.Management.Automation.Language.Parser]::ParseFile(
"scripts/install.ps1", [ref]$tokens, [ref]$errors
) | Out-Null
if ($errors.Count -ne 0) {
$errors | ForEach-Object { Write-Error $_.ToString() }
exit 1
}
- name: Cache Rust inputs
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
shared-key: cargo-home-${{ runner.os }}-${{ runner.arch }}
cache-targets: false
- name: Configure compiler cache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
with:
version: "v0.16.0"
- name: Run native Windows tests
run: cargo test --workspace --exclude codegraph-bench --locked
# A retained SQLite handle makes the replacement rename fail with a
# sharing violation, so this remains an explicit native acceptance gate.
- name: Run long-lived MCP database replacement acceptance
run: cargo test -p codegraph-rs --locked --test batch_m_long_lived_mcp
# FSEvents is the one native-recursive watcher backend no other job runs:
# Linux uses inotify and Windows ReadDirectoryChangesW. This job runs the
# symlink-following scan and watcher tests on macOS (#770), and the burst
# that may drop or coalesce events (#1397).
macos-watcher:
name: macOS Watcher
needs: workspace-version
runs-on: macos-15
timeout-minutes: 40
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master 2026-09-12
with:
toolchain: 1.98.0
- name: Verify workspace version surfaces before Cargo/cache
run: bash scripts/check-workspace-versions.sh
- name: Cache Rust inputs
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
shared-key: cargo-home-${{ runner.os }}-${{ runner.arch }}
cache-targets: false
- name: Configure compiler cache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
with:
version: "v0.16.0"
- name: Run the symlink scan and watcher tests
run: |
cargo test -p codegraph-extract --locked --test scan_symlinks
cargo test -p codegraph-watch --locked symlink
- name: Run the event-loss convergence test
run: cargo test -p codegraph-watch --locked --test event_loss
ui:
name: UI
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
cache: npm
cache-dependency-path: ui/package-lock.json
# npm ci from the committed lockfile, svelte-check, the vitest suites, a
# production build, and a byte check that the embedded bundle under
# crates/codegraph-ui/viewer is exactly this build.
- name: Check, test and rebuild the viewer
run: make ui-check
audit:
name: Security Audit
needs: workspace-version
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master 2026-09-12
with:
toolchain: 1.98.0
- name: Verify workspace version surfaces before Cargo
run: bash scripts/check-workspace-versions.sh
- name: Install cargo-audit
uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29
with:
tool: cargo-audit@0.22.2
- name: Audit dependencies
run: cargo audit
# Informational by policy: omitted from CI Success and informational in
# codecov.yml. A reporting outage or a below-target percentage cannot block.
coverage:
name: Coverage
needs: workspace-version
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master 2026-09-12
with:
toolchain: 1.98.0
components: llvm-tools-preview
- name: Verify workspace version surfaces before Cargo/cache
run: bash scripts/check-workspace-versions.sh
- name: Cache Rust inputs
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
shared-key: cargo-home-${{ runner.os }}-${{ runner.arch }}
cache-targets: false
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29
with:
tool: cargo-llvm-cov@0.8.7
- name: Generate coverage
# Instrumented builds bypass the compiler cache: this job never
# configures sccache, so the workflow-level wrapper must not apply.
env:
RUSTC_WRAPPER: ""
SCCACHE_GHA_ENABLED: "false"
run: make coverage-lcov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
files: lcov.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
ci-success:
name: CI Success
needs: [workspace-version, linux, windows-clippy, windows-test, macos-watcher, ui, audit]
if: always()
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Require every CI job to succeed
env:
NEEDS_JSON: ${{ toJSON(needs) }}
run: |
set -euo pipefail
if [ -z "${NEEDS_JSON:-}" ]; then
echo "::error title=CI gate::the needs context was empty; failing closed"
exit 1
fi
if ! printf '%s' "$NEEDS_JSON" | jq -e 'type == "object" and length > 0' >/dev/null 2>&1; then
echo "::error title=CI gate::the needs context was not a non-empty object; failing closed"
exit 1
fi
mapfile -t rows < <(
printf '%s' "$NEEDS_JSON" \
| jq -r 'to_entries | sort_by(.key)[] | "\(.key)\t\(.value.result // "<missing>")"'
)
((${#rows[@]} > 0)) || { echo "::error title=CI gate::no required jobs found"; exit 1; }
offenders=0
for row in "${rows[@]}"; do
job="${row%%$'\t'*}"
result="${row#*$'\t'}"
if [ "$result" = success ]; then
printf ' OK %-20s %s\n' "$job" "$result"
else
printf ' FAIL %-20s %s\n' "$job" "$result"
echo "::error title=CI gate::required job '${job}' concluded '${result}', not 'success'"
offenders=$((offenders + 1))
fi
done
if [ "$offenders" -ne 0 ]; then
echo "CI failed: ${offenders} of ${#rows[@]} required job(s) did not conclude 'success'."
exit 1
fi
echo "CI passed: all ${#rows[@]} required job(s) concluded 'success'."