Repository navigation
400 lines (384 loc) · 16.1 KB
/
Copy pathci.yml
File metadata and controls
400 lines (384 loc) · 16.1 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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
name: CI
on:
pull_request:
types: [opened, edited, synchronize, reopened]
push:
branches: [master, dev]
workflow_call:
inputs:
ref:
description: Exact commit to validate.
type: string
required: false
default: ""
pr_number:
description: Release pull request whose title and commits must be checked.
type: number
required: false
default: 0
# A new push to a pull request supersedes its running checks. Integration pushes
# and release validation finish, so every actual landed commit gets a verdict.
concurrency:
group: ci-${{ inputs.ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
pull-requests: read
env:
CARGO_TERM_COLOR: always
# No debugger symbols in CI: links are faster and the caches several times smaller.
# A failing test still names itself and its assertion.
CARGO_PROFILE_DEV_DEBUG: "0"
CARGO_PROFILE_TEST_DEBUG: "0"
# How the jobs share work: `lint` checks (clippy, rustdoc) and `test` builds, so neither
# repeats the other's compilation. Caches are saved by pushes to `dev` and `master`, also when a step fails, and
# pull requests restore them.
jobs:
policy:
name: Repository policy
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
with:
ref: ${{ inputs.ref || github.ref }}
# Plugin API compatibility compares with the latest release tag.
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/setup-node@v4
with:
node-version: "22"
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.98.0"
- uses: taiki-e/install-action@v2
with:
tool: cargo-machete@0.9.2,cargo-deny
# Every step runs even when an earlier one fails, so one run reports every problem.
- name: Agent hooks and configuration
run: |
python3 -B scripts/test-claude-hooks.py
python3 -B scripts/test-claude-config.py
python3 -B scripts/check-claude-config.py
- name: Plugin API compatibility
if: ${{ !cancelled() }}
run: |
python3 -B scripts/test-plugin-api-compat.py
python3 -B scripts/check-plugin-api-compat.py
- name: Release pipeline
if: ${{ !cancelled() }}
env:
NODE_PATH: ${{ runner.temp }}/release-pipeline-tests/node_modules
run: |
npm install --prefix "$RUNNER_TEMP/release-pipeline-tests" --ignore-scripts --no-audit --no-fund release-please@17.3.0 yaml@2.9.1
node scripts/test-release-pipeline.cjs
python3 scripts/test-prepare-release-pr.py
python3 scripts/test-architecture-history.py
# Packaging rejects stale notices only after merge; catch the drift while the change
# is open. Release pull requests get their notices regenerated by release.yml, which
# then validates the prepared commit through this workflow.
- name: Third-party notice inputs
if: ${{ !cancelled() && !startsWith(github.head_ref, 'release-please--') }}
run: python3 scripts/generate-license-notices.py --check-inputs
# Manifest-only. --with-metadata is not used: it rewrites Cargo.lock.
- name: Unused dependencies
if: ${{ !cancelled() }}
run: cargo machete --skip-target-dir
- name: Dependency advisories
if: ${{ !cancelled() }}
run: cargo deny check advisories
conventions:
name: Conventional Commits
if: github.event_name == 'pull_request' || inputs.pr_number != 0
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ inputs.ref || github.ref }}
- name: Read release pull request
if: inputs.pr_number != 0
id: pr
uses: actions/github-script@v7
with:
script: |
const {data: pr} = await github.rest.pulls.get({
...context.repo, pull_number: ${{ inputs.pr_number || 0 }}
});
core.setOutput('title', pr.title);
core.setOutput('base', pr.base.sha);
# Ordinary release PRs squash to their title. Correlated vendor/product
# PRs preserve separate Conventional Commits through rebase merge,
# including dev-to-master promotions; every PR title remains valid.
- name: Lint PR title
env:
PR_TITLE: ${{ steps.pr.outputs.title || github.event.pull_request.title }}
run: |
printf '%s\n' "$PR_TITLE" > "$RUNNER_TEMP/title"
scripts/lint-commit-msg.sh "$RUNNER_TEMP/title"
- name: Lint commits
if: ${{ !cancelled() }}
env:
BASE: ${{ steps.pr.outputs.base || github.event.pull_request.base.sha }}
HEAD: ${{ inputs.ref || github.event.pull_request.head.sha }}
run: |
status=0
for sha in $(git rev-list --no-merges "$BASE..$HEAD"); do
git log -1 --format=%B "$sha" > "$RUNNER_TEMP/msg"
scripts/lint-commit-msg.sh "$RUNNER_TEMP/msg" || status=1
done
exit $status
- name: Check architectural baseline and vendor commit separation
if: ${{ !cancelled() }}
env:
BASE: ${{ steps.pr.outputs.base || github.event.pull_request.base.sha }}
HEAD: ${{ inputs.ref || github.event.pull_request.head.sha }}
run: python3 scripts/check-architecture-history.py --base "$BASE" --head "$HEAD"
integration-history:
name: Integrated architectural history
if: github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ github.sha }}
- name: Check actual integrated commits
env:
BASE: ${{ github.event.before }}
HEAD: ${{ github.sha }}
run: |
if [ "$BASE" = "0000000000000000000000000000000000000000" ]; then
echo "::error::Integration history needs an existing before commit; branch creation is not a validated promotion."
exit 1
fi
git cat-file -e "$BASE^{commit}" || git fetch --no-tags origin "$BASE"
python3 scripts/check-architecture-history.py --base "$BASE" --head "$HEAD"
lint:
name: Lint and docs
runs-on: ubuntu-latest
timeout-minutes: 45
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v5
with:
ref: ${{ inputs.ref || github.ref }}
- name: Install native dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config clang cmake libssl-dev \
libfontconfig1-dev libfreetype6-dev libxkbcommon-dev libxkbcommon-x11-dev \
libwayland-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libvulkan-dev
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.98.0"
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
save-if: ${{ github.event_name == 'push' }}
- run: cargo fmt --all --check
- name: Clippy
if: ${{ !cancelled() }}
run: cargo clippy --locked --workspace --all-targets -- -D warnings
- name: Rustdoc
if: ${{ !cancelled() }}
run: cargo doc --locked --workspace --no-deps
test:
name: Build and test
runs-on: ubuntu-latest
timeout-minutes: 60
env:
NOCTERM_REQUIRE_SSHD: "1"
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v5
with:
ref: ${{ inputs.ref || github.ref }}
- name: Install native dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config clang cmake libssl-dev \
libfontconfig1-dev libfreetype6-dev libxkbcommon-dev libxkbcommon-x11-dev \
libwayland-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libvulkan-dev mesa-vulkan-drivers openssh-server openssh-client dbus
sudo mkdir -p /run/sshd
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.98.0"
components: clippy
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
save-if: ${{ github.event_name == 'push' }}
workspaces: |
. -> target
examples/plugins/focus-timer -> target
# One compilation for everything below: the tests reuse it, and the xtask binary is
# run directly, because `cargo xtask` resolves features for xtask alone and rebuilds.
- name: Build
id: build
run: cargo build --locked --workspace --all-targets
- name: Generated documents are current
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
run: target/debug/xtask docs --check
- name: Architecture rules
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
run: target/debug/xtask architecture
# The example code plugin is a workspace of its own. The workspace tests load the module
# it builds, so a Rust guest runs through the real check and runtime.
- name: Build and test the example code plugin
id: guest
if: ${{ !cancelled() }}
run: |
cargo clippy --locked --all-targets --manifest-path examples/plugins/focus-timer/Cargo.toml -- -D warnings
cargo test --locked --manifest-path examples/plugins/focus-timer/Cargo.toml
cargo build --locked --release --target wasm32-unknown-unknown \
--manifest-path examples/plugins/focus-timer/Cargo.toml
- name: Run workspace tests
if: ${{ !cancelled() && steps.build.outcome == 'success' && steps.guest.outcome == 'success' }}
env:
NOCTERM_GUEST_WASM: ${{ github.workspace }}/examples/plugins/focus-timer/target/wasm32-unknown-unknown/release/focus_timer.wasm
NOCTERM_REQUIRE_WASM_GUEST: "1"
run: |
set -o pipefail
cargo test --locked --workspace 2>&1 | tee "$RUNNER_TEMP/nocterm-workspace-tests.log"
- name: Report workspace test failures
if: failure()
run: |
python3 - <<'PYTHON'
import os
from pathlib import Path
log = Path(os.environ["RUNNER_TEMP"]) / "nocterm-workspace-tests.log"
if log.is_file():
excerpt = "\n".join(log.read_text(errors="replace").splitlines()[-100:])[-16000:]
for start in range(0, len(excerpt), 3000):
chunk = excerpt[start:start + 3000]
escaped = chunk.replace("%", "%25").replace("\r", "%0D").replace("\n", "%0A")
print("::error title=Workspace test failure::" + escaped)
PYTHON
vendored:
name: Vendored crates
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v5
with:
ref: ${{ inputs.ref || github.ref }}
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Test archive authentication and replay failures
run: python3 scripts/test-vendor-patches.py
- name: Replay published archives and patches
if: ${{ !cancelled() }}
run: python3 scripts/check-vendor-patches.py
- name: Install native dependencies
if: ${{ !cancelled() }}
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config clang cmake libssl-dev \
libfontconfig1-dev libfreetype6-dev libxkbcommon-dev libxkbcommon-x11-dev \
libwayland-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libvulkan-dev mesa-vulkan-drivers dbus
- uses: dtolnay/rust-toolchain@stable
if: ${{ !cancelled() }}
with:
toolchain: "1.98.0"
- uses: Swatinem/rust-cache@v2
if: ${{ !cancelled() }}
with:
cache-on-failure: true
save-if: ${{ github.event_name == 'push' }}
workspaces: |
vendor/alacritty_terminal -> target
vendor/gpui-component -> target
- name: Test the vendored terminal emulator
if: ${{ !cancelled() }}
run: cargo test --manifest-path vendor/alacritty_terminal/Cargo.toml --lib
- name: Verify native menu patch
if: ${{ !cancelled() }}
run: cargo test --manifest-path vendor/gpui-component/Cargo.toml --locked --features test-support --lib menu::app_menu_bar
# Installers ship for Windows, so a pull request also checks that the whole application
# builds there; release validation would otherwise be the first to compile it.
device-unlock-native:
name: Native build on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 45
steps:
- uses: actions/checkout@v5
with:
ref: ${{ inputs.ref || github.ref }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.98.0"
components: clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
save-if: ${{ github.event_name == 'push' }}
- name: Compile and link native adapters
run: cargo build --locked -p nocterm-vault-store -p nocterm-device-unlock --all-targets
- name: Lint native adapters
run: cargo clippy --locked -p nocterm-vault -p nocterm-vault-store -p nocterm-device-unlock --all-targets -- -D warnings
- name: Test portable envelope and native metadata without authentication prompts
run: cargo test --locked -p nocterm-vault -p nocterm-vault-store -p nocterm-device-unlock
- name: Test held filesystem capabilities on Windows
if: runner.os == 'Windows'
run: cargo test --locked -p nocterm-localfs
- name: Test bounded native file reads on Windows
if: runner.os == 'Windows'
run: cargo test --locked -p nocterm-core --lib fs::tests::bounded_read
- name: Test SSH native file reads on Windows
if: runner.os == 'Windows'
run: cargo test --locked -p nocterm-ssh --lib file::tests
- name: Test native chat history on Windows
if: runner.os == 'Windows'
run: cargo test --locked -p nocterm --test native_history
- name: Test authenticated MCP bridge after idle and refresh on Windows
if: runner.os == 'Windows'
run: cargo test --locked -p nocterm-acp --lib bridge::tests
- name: Check the application builds for Windows
if: runner.os == 'Windows'
run: cargo check --locked -p nocterm
# Held directories, chat history and agent launch have Windows-only code paths:
# run them against the real filesystem and process APIs there.
- name: Lint Windows history adapters and test agent environment
if: runner.os == 'Windows'
run: |
cargo clippy --locked -p nocterm-localfs -p nocterm-agent-storage -p nocterm-agent-runtime --all-targets -- -D warnings
cargo test --locked -p nocterm-ai -p nocterm-agent-storage
cargo test --locked -p nocterm --test native_chat_history
# The one check to require in branch protection: it passes only when every
# job above passed or was skipped by design, so adding a job never needs a
# settings change.
ci-passed:
name: CI passed
if: always()
needs: [policy, conventions, integration-history, lint, test, vendored, device-unlock-native]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Require every job to pass
env:
RESULTS: ${{ toJSON(needs) }}
run: |
python3 - <<'PYTHON'
import json, os
failed = {name: job["result"] for name, job in json.loads(os.environ["RESULTS"]).items()
if job["result"] not in ("success", "skipped")}
for name, result in failed.items():
print(f"::error title=CI job {name}::{name} finished as {result}")
raise SystemExit(1 if failed else 0)
PYTHON