Repository navigation
466 lines (466 loc) · 24.6 KB
/
Copy pathci.yml
File metadata and controls
466 lines (466 loc) · 24.6 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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.89.0
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: execution ownership guard
run: python3 scripts/check_execution_ownership.py
- name: execution ownership guard negative-exit proof
run: python3 scripts/check_execution_ownership.py --prove-negative-exit
# The design record used to cite *line numbers*. A line number is a
# property of the text, not of the symbol: every unrelated edit above the
# target invalidated it, and 85% of the resolvable citations no longer
# resolved at the line they named. The gate makes the record cite
# symbols instead, so a citation survives an edit that moves the code.
# It is stdlib-only Python and reads the tree, so it runs the same on
# every host and needs nothing built first.
- name: documentation citation guard
run: python3 scripts/check_doc_citations.py
- name: documentation citation guard negative-exit proof
run: python3 scripts/check_doc_citations.py --prove-negative-exit
# `docs/quickstart.md` is the user-facing instruction and
# `scripts/quickstart.sh` is the executed version of it. They are two
# renderings of one procedure, so they are checked against each other:
# the document's commands must be the script's commands, and the doctor
# output the document shows must be the output the node emits.
- name: quickstart document and script sync
run: python3 scripts/check_quickstart_sync.py
- run: cargo fmt --all -- --check
# `--locked` is load-bearing. A workspace version bump that does not
# update `Cargo.lock` builds fine locally and passes both of these, then
# fails every release build at `cargo build --locked`. That cost a full
# release attempt: the `v0.1.3` producer run failed closed on it. CI must
# catch a stale lock before a release does.
- run: cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
# The runner's capability probe drives the *built* sandbox helper and
# fails loudly when it is absent, so the helper has to exist before the
# test step runs. Building it explicitly is what makes the precondition
# deterministic rather than incidental.
- name: build the sandbox helper the capability probe drives
run: cargo build --locked -p eggwork-sandbox-helper
# The default test step does **not** enable the `qualification` feature:
# the qualification suite names an installed release as its subject
# through the environment, so it belongs in the `installed-qualification`
# job below, which stages that installation. Its tests are `#[ignore]`d
# as well, so adding `--all-features` here would not run them either.
- run: cargo test --locked --workspace --all-targets
- run: cargo check --workspace
- name: release identity coherence
# The release gate has two halves. The tag-dependent half — "does the
# tag about to be created name the workspace version?" — cannot live
# in CI: CI never knows the future tag, and the generated release
# workflow is producer authority. `scripts/check_release_tag.py` owns
# that comparison and is run by whoever cuts the tag, before the tag
# exists.
#
# The tag-independent half is the workspace manifest's version against
# the versions `Cargo.lock` pins for this repository's own packages.
# That is what this step asserts, on every push and every pull
# request, and it is exactly the condition that broke the `v0.1.3`
# release attempt.
run: python3 scripts/check_release_tag.py --coherence
- name: release candidate validator tests
# These are the tag guard's own tests: they exercise the code path
# that decides whether a release may be tagged, against fixtures, so
# the guard's correctness is an executed result rather than a trusted
# assumption.
run: python3 -m unittest discover --start-directory tests/release --top-level-directory tests/release
windows-runner:
# The Windows process-tree backend cannot be observed from Linux: Job Object
# ownership, descendant convergence, and pipe inheritance only mean something
# on a real Windows kernel. This job is the native evidence for Foundation
# M004, so a green Linux run must never be read as Windows coverage.
#
# Scope is deliberately narrow. `eggwork-runner` runs its full suite on
# Windows; the server's own unit tests are `/bin/sh`-shaped and stay
# Linux-only until a separate milestone reshapes them. One server
# integration target is portable and is run below, so it is the native
# evidence that a node which cannot capture declared outputs refuses them
# instead of dropping them. The service host adds two more targets that
# *are* Windows-shaped — the host's lifecycle and its service identity —
# and they are run here. The installed production path (installed
# release bytes, not a build tree) is qualified by the
# `operational-qualification` workflow, not here, and the real service
# control manager lifecycle is the `windows-service-host` job below.
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.89.0
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
key: windows-msvc
# Production code, linted on the Windows target: this is where a
# Windows-only regression actually matters, and it is the surface a
# release binary is built from.
- run: cargo clippy --locked --workspace --lib --bins --all-features -- -D warnings
# Test targets only for the crates this job can honestly claim.
# `eggwork-server` and `eggwork-client` *unit* tests are Linux-shaped
# (they spawn `/bin/sh` and set `0700` modes through `std::os::unix`),
# so they do not compile for Windows and are not claimed as coverage.
# Making them portable is its own milestone; until then this job's scope
# is stated, not widened to hide the gap.
- name: eggwork-runner test targets
run: cargo clippy --locked -p eggwork-runner --all-targets --all-features -- -D warnings
- name: Windows process-tree lifecycle suite
# The runner's capability probe drives the built sandbox helper and
# fails loudly when it is absent, so this job would need the helper
# built too. It does not: the helper-dependent half of that probe is
# `#[cfg(target_os = "linux")]`, so it does not exist in this job at
# all, and only the platform-neutral negative case — a missing helper
# must not advertise a capability — runs here. The Linux `rust` job
# builds the helper explicitly and runs the full probe.
run: cargo test --locked -p eggwork-runner --all-targets -- --nocapture
# One portable server integration target, and only that target. The
# declared-artifact capture disposition is a contract about the
# *decision* rather than about the host, so it is checked from a target
# that compiles for Windows: this is the native evidence that a node
# which cannot capture declared outputs refuses them and ends the
# execution in a state that is not a success. The rest of the server's
# test surface is still Linux-only and is not claimed here.
- name: declared-artifact capture disposition suite
run: cargo test --locked -p eggwork-server --test artifact_capture_disposition
# The service-host lifecycle and the service identity contract.
#
# These two targets are the Windows service host's own surface. They are
# run explicitly here because the server's *unit* tests are
# `/bin/sh`-shaped and do not compile for Windows, so the server's test
# surface as a whole cannot be claimed here. These two can, and they
# are what the service host is made of.
- name: service-host lifecycle suite
run: cargo test --locked -p eggwork-server --bin eggworkd -- --nocapture
- name: service-host identity contract
run: cargo test --locked -p eggwork-server --test windows_service_contract -- --nocapture
# Only the two Windows targets are linted. `--tests` would build the
# server's Linux-shaped unit-test target as well, and that target does
# not compile for Windows.
- name: service-host test targets
run: cargo clippy --locked -p eggwork-server --test windows_service_contract --test windows_service_lifecycle -- -D warnings
windows-service-host:
# The Windows service host is proved by mutating a real service control
# manager registration on the hosted runner: install, start, answer an
# authenticated request while the manager says Running, stop with an
# active execution, start again, restart, uninstall, and prove that a
# same-name registration that is not Eggwork's is never touched.
#
# The daemon is built from source here. The *installed release* service
# lifecycle belongs to Operations M004, which owns release lineage and
# the exact installed bytes; this job owns the source-built proof.
#
# Every mutation goes through the product's own operator CLI and Eggup's
# typed adapter. The one exception is the foreign-ownership negative,
# which has to create a registration that is not Eggwork's, and that is
# test orchestration rather than a second production manager.
runs-on: windows-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.89.0
- uses: Swatinem/rust-cache@v2
with:
key: windows-msvc
- name: build the daemon under test
run: cargo build --locked -p eggwork-server --bin eggworkd
- name: stage the installation root
# The directories are created 0755 rather than with the shell's umask,
# because the installed helper's trust check walks every ancestor of
# its own path and refuses a group- or world-writable one.
shell: bash
run: |
set -euo pipefail
root="${{ runner.temp }}/service-host"
mkdir -p "$root/bin"
install -m 0755 target/debug/eggworkd.exe "$root/bin/eggworkd.exe"
chmod 0755 "$root" "$root/bin"
- name: reserve the loopback port
# The service-hosted node has to bind an address the test can reach,
# and the manager's state alone would not prove the node is serving.
# The port is reserved and released, and the node binds it for the
# duration of the lifecycle.
shell: pwsh
run: |
$listener = [System.Net.Sockets.TcpListener]::new([System.Net.IPAddress]::Loopback, 0)
$listener.Start()
$port = $listener.LocalEndpoint.Port
$listener.Stop()
"EGGWORK_QUALIFY_BIND=127.0.0.1:$port" >> $env:GITHUB_ENV
- name: materialise the bounded fixture
# The repository's own rcgen-based fixture, not a runner-provided one:
# a certificate the installed binary rejects would look like a product
# defect rather than a fixture problem.
shell: bash
run: |
set -euo pipefail
EGGWORK_QUALIFY_ROOT="${{ runner.temp }}/service-host" \
cargo test --locked -p eggwork-server --features qualification \
--test installed_qualification -- --ignored --exact qualification_fixture
- name: qualify the hosted service lifecycle
shell: bash
env:
EGGWORK_QUALIFY_ROOT: ${{ runner.temp }}/service-host
EGGWORK_SERVICE_DAEMON: ${{ runner.temp }}/service-host/bin/eggworkd.exe
run: |
set -euo pipefail
cargo test --locked -p eggwork-server --test windows_service_lifecycle \
-- --ignored --nocapture
- name: the registration is gone
# The lifecycle removes its own registration, and a failed assertion
# must not leave one behind. This step is the belt to the test's
# braces: it fails the job if a registration survives the run.
#
# The step ends with an explicit `exit 0`, because `sc.exe query`
# exits non-zero when the service does not exist — which is the
# outcome this step wants. Without the explicit exit, the step
# inherits that non-zero code and turns a passed check into a failed
# job. This is the same trap M004 recorded for the Windows
# disposition step.
shell: pwsh
run: |
$existing = sc.exe query eggwork-node 2>&1 | Out-String
if ($LASTEXITCODE -eq 0) {
Write-Error "a service registration survived the lifecycle job: $existing"
exit 1
}
Write-Output "no service registration survived the lifecycle job"
exit 0
macos-runner:
# The release matrix builds macos-x64 and macos-arm64, and nothing in this
# workflow exercised a macOS target, so a macOS-only regression could reach
# a release candidate unobserved. This job is the native evidence that the
# shipped surface compiles and its platform-neutral tests pass on macOS.
#
# Scope is deliberately narrow and mirrors the Windows job. The runner's
# test targets are portable and run here; the server's own unit tests are
# `/bin/sh`-shaped and are not claimed here, except for the one portable
# integration target the Windows job already runs.
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.89.0
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
key: macos-arm64
# The production surface a release binary is built from, linted on the
# macOS target.
- run: cargo clippy --locked --workspace --lib --bins --all-features -- -D warnings
# The runner's test targets: the `OutputChunk` shape and the platform
# tree backend are both exercised here.
- name: eggwork-runner test targets
run: cargo clippy --locked -p eggwork-runner --all-targets --all-features -- -D warnings
- name: eggwork-runner test suite
run: cargo test --locked -p eggwork-runner --all-targets -- --nocapture
# The same portable server integration target the Windows job runs.
- name: declared-artifact capture disposition suite
run: cargo test --locked -p eggwork-server --test artifact_capture_disposition
macos-x64-runner:
# The release matrix builds macos-x64 and macos-arm64. `macos-runner`
# covers the arm64 target; this job covers the x64 one, so both macOS
# targets the matrix builds are exercised rather than only the one the
# hosted image happens to be.
#
# The scope mirrors `macos-runner` exactly. A target that is only
# compiled is not exercised, and an exercised target is not a qualified
# one: this job is the native evidence that the shipped surface compiles
# and its platform-neutral tests pass on macos-x64.
#
# `macos-15-intel` is the x64 image. The one before it, `macos-13`, is
# retired, and a job pinned to a retired image queues forever instead of
# failing, which is the worst possible failure for a gate.
runs-on: macos-15-intel
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.89.0
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
key: macos-x64
- run: cargo clippy --locked --workspace --lib --bins --all-features -- -D warnings
- name: eggwork-runner test targets
run: cargo clippy --locked -p eggwork-runner --all-targets --all-features -- -D warnings
- name: eggwork-runner test suite
run: cargo test --locked -p eggwork-runner --all-targets -- --nocapture
- name: declared-artifact capture disposition suite
run: cargo test --locked -p eggwork-server --test artifact_capture_disposition
quickstart:
# The quickstart is a *procedure*, and `docs/quickstart.md` is the
# user-facing instruction while `scripts/quickstart.sh` is its executed
# form. This job runs the script end to end on Linux against a locally
# built node with generated TLS material, so the document's claims are
# checked against a node that actually ran rather than against prose.
#
# The script needs `cargo`, `openssl`, `python3` and `stat`; all four are
# present on `ubuntu-latest`. It generates its own TLS material, installs
# the helper where the helper's trust check accepts it, and stops the node
# on every failure path, so a failed step never leaves a process holding
# the state directory's lock.
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.89.0
- uses: Swatinem/rust-cache@v2
- name: run the quickstart end to end
shell: bash
run: |
set -euo pipefail
bash scripts/quickstart.sh
installed-qualification:
# The `qualification`-feature suite qualifies an *installed* release: it
# names its subject through the environment (`EGGWORK_QUALIFY_DAEMON`,
# `EGGWORK_QUALIFY_CONFIG`, `EGGWORK_QUALIFY_TLS_DIR`) and its three
# tests are `#[ignore]`d.
#
# That is why the default `cargo test` step does not enable the feature.
# Adding `--all-features` there would compile the file, but the
# `#[ignore]` attributes would still keep all three tests out of the run,
# and an ordinary test run has no installed release to drive in the first
# place. The suite is therefore executed here, in the job that stages the
# installation it drives, so a green CI run is evidence that the code
# ran rather than only that it type-checked.
#
# The `operational-qualification` workflow runs the same suite against a
# *published* release's exact bytes. This job runs it against the bytes
# this repository builds, on every push and every pull request.
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.89.0
- uses: Swatinem/rust-cache@v2
- name: build the installed product surface
run: cargo build --locked -p eggwork-server -p eggwork-sandbox-helper --bins
- name: stage the installation root
# The directories are created 0755 rather than with the shell's umask,
# because the installed helper's trust check walks every ancestor of
# its own path and refuses a group- or world-writable one.
shell: bash
run: |
set -euo pipefail
root="${{ runner.temp }}/qualification"
mkdir -p "$root/bin"
install -m 0755 target/debug/eggworkd "$root/bin/eggworkd"
install -m 0755 target/debug/eggwork-sandbox-helper "$root/bin/eggwork-sandbox-helper"
chmod 0755 "$root" "$root/bin"
- name: check the installation root's trust chain
# The product's own rule, checked before the node is started: the
# helper's path and every ancestor of it must be free of group- and
# world-writable bits. The qualification harness's `ensure_trusted_root`
# fails closed on the same condition; here it is checked explicitly so
# a runner whose temporary directory is group-writable reports that
# reason instead of the node refusing its own helper.
shell: bash
env:
INSTALL_ROOT: ${{ runner.temp }}/qualification
run: |
set -euo pipefail
current="$INSTALL_ROOT"
while true; do
mode=$(stat -c '%a' "$current")
world="${mode: -1}"
group="${mode: -2:1}"
if [ $(( world & 2 )) -ne 0 ] || [ $(( group & 2 )) -ne 0 ]; then
echo "$current is group/world writable (mode $mode); the installed helper's trust check walks every ancestor and would reject it" >&2
exit 1
fi
parent=$(dirname "$current")
if [ "$parent" = "$current" ]; then
break
fi
current="$parent"
done
- name: materialise the bounded qualification fixture
# The TLS fixture and node configuration come from the repository's own
# `rcgen`-based harness, not from whichever OpenSSL the runner ships.
shell: bash
env:
EGGWORK_QUALIFY_ROOT: ${{ runner.temp }}/qualification
run: |
set -euo pipefail
cargo test --locked -p eggwork-server --features qualification \
--test installed_qualification -- --ignored --exact qualification_fixture
- name: qualify installed execution through the production client
# Both qualification tests run against the fixture the previous step
# materialised; the fixture itself is skipped here so it is not
# re-materialised underneath the node that is already running.
#
# `--test-threads=1` is load-bearing. The two tests share one
# installation root, one state directory, and one execution-state
# lock, so a concurrent second daemon cannot start: the first test
# would fail with "the installed daemon exited before reporting
# ready". They are one installation, qualified one at a time.
shell: bash
env:
EGGWORK_QUALIFY_DAEMON: ${{ runner.temp }}/qualification/bin/eggworkd
EGGWORK_QUALIFY_CONFIG: ${{ runner.temp }}/qualification/state/node.json
EGGWORK_QUALIFY_TLS_DIR: ${{ runner.temp }}/qualification/state/tls
EGGWORK_QUALIFY_PLATFORM: linux
run: |
set -euo pipefail
cargo test --locked -p eggwork-server --features qualification \
--test installed_qualification -- --ignored --skip qualification_fixture \
--test-threads=1 --nocapture
- name: quickstart doctor output against the node's report
# The quickstart document shows a `doctor` report. The set of check
# names it shows must equal the set the node emits, in the same order:
# the document once showed seven checks while the node emitted eight,
# and nothing caught it. This step runs the installed daemon's own
# `doctor` against the fixture this job materialised and compares the
# two, so the shown output is a fact rather than a picture.
#
# `doctor` exits non-zero when any check is not ok, which is a verdict
# about the *node*, not about the document. The qualification step
# above already requires a healthy node, so this step's assertion is
# the comparison alone: the report is captured whatever the verdict,
# and an unreadable or empty report fails the comparison with a clear
# message.
shell: bash
env:
EGGWORK_QUALIFY_ROOT: ${{ runner.temp }}/qualification
run: |
set -euo pipefail
status=0
"$EGGWORK_QUALIFY_ROOT/bin/eggworkd" doctor \
--config "$EGGWORK_QUALIFY_ROOT/state/node.json" \
> "$EGGWORK_QUALIFY_ROOT/doctor.json" || status=$?
printf 'doctor exited %s; the comparison below is the assertion\n' "$status"
python3 scripts/check_quickstart_sync.py \
--doctor-report "$EGGWORK_QUALIFY_ROOT/doctor.json"
release-drift:
# Eggpack is producer authority for the release matrix: the generated
# release workflow must be exactly what the pinned tool renders from the
# checked-in static configuration. This job never builds, publishes, or
# stages anything; it only fails when the checked-in bytes drift.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.89.0
- name: install the pinned Eggpack tool
shell: bash
run: |
set -euo pipefail
revision="$(python3 -c "import json,sys;sys.stdout.write(json.load(open('release/eggpack/github-policy.json'))['eggpack_tool']['revision'])")"
cargo install --git https://github.com/eggstack/eggpack --rev "$revision" --locked eggpack-cli
eggpack --version
- name: check the generated release workflow against the checked-in configuration
shell: bash
run: |
set -euo pipefail
eggpack ci check \
--workflow-shape release/eggpack/workflow-shape.json \
--contract release/eggpack/distribution.toml \
--github-policy release/eggpack/github-policy.json \
--workflow .github/workflows/release.yml