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
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
name: CI
# EVERY JOB RUNS CHORE TASKS, so a green local `chore test` is the same
# evidence as a green run here (see the test contract at the top of
# chores.yml):
#
# unit `chore test:unit` on a runner with NO fixtures: the tests
# that need no tool, no fixture and no VM, in the debug
# profile that traps an arithmetic overflow. That the job
# passes with test-disks/ empty is what proves the split.
# fixtures `chore fixtures`: the kernel-made images, built in the
# fs-linux-test-harness VM under KVM on x86_64, and handed
# to the other jobs as an artifact (they are disk images,
# the same for every architecture).
# test x86_64, where GitHub gives us KVM: `chore lint` and
# `chore test` — the whole gate, with EVERY e2fsprogs call,
# every kernel mount and every lwext4 call happening inside
# the harness VM. Nothing installs e2fsprogs on the runner,
# and the log shows `[oracle vm]` / `[kernel vm]` for each
# one. The guest also builds lwext4 (a third ext4
# implementation, at the commit scripts/vm-setup.sh pins)
# so `chore test:lwext4` can cross-validate against it.
# test-arm64 aarch64 matters on its own (c_char is unsigned there, and
# Apple Silicon hosts run on it) but GitHub's arm64
# runners have NO KVM, so no VM can run: this job runs the
# tiers that need none — lint, the unit tier, and the
# fixture-reading tests. The tool, kernel and lwext4
# oracles are architecture-independent (they read the same
# images) and are covered by `test`; so are the script
# tests, which check the tree rather than the machine.
# suite-in-vm `chore test:vm`: the whole suite COMPILED AND RUN INSIDE
# the guest. That is how a macOS host runs a Linux suite,
# and this job is what keeps that path working.
# wasm `chore test:wasm`: the browser build (wasm32-unknown-
# unknown) RUN under wasm-bindgen-test in Node, because std
# there compiles clock and process-ID calls that panic at
# run time -- a build-only check cannot see them.
# semver `chore check:semver`: the public API against the newest
# crates.io release, refusing a break Cargo.toml's version
# does not declare (#120).
# msrv `chore check:msrv`: the library and the binaries built on
# the toolchain Cargo.toml's `rust-version` names, so the
# declared minimum stays the true one.
# cli `chore cli:install` then `chore test:cli`: the command-line
# tools built in release mode, staged under every name first
# on PATH, and tested AS INSTALLED -- `rust-fs-ext4 doctor`
# first, then tests/cli/*.sh. A change that breaks a tool
# fails the pull request, not the release. No VM: what
# e2fsprogs makes of the tools' output is judged in the
# oracle tier (tests/cli_*_oracle.rs).
# provenance `chore check:provenance`: no tracked file names a Linux
# kernel or e2fsprogs function, internal macro or source
# path (AGENTS.md, "Clean room"). No toolchain, no fixtures:
# it reads the tree, so it answers in seconds.
# ci-ok the one required check: green only when every job above
# ran and succeeded (failed, cancelled OR skipped fails it).
#
# THE OUTPUT BUDGET IS IN THE TASKS, so it is in this workflow too. Each
# tier writes its full output to tmp/logs/<tier>.log and prints a verdict;
# a tier that prints more than its measured budget FAILS (exit 65), which
# is how a job that starts emitting thousands of lines turns red here
# rather than being noticed by whoever scrolls it next. See the budget
# table at the top of chores.yml, and the harness README's "Output: quiet
# by default, --verbose on request". Nothing extra is needed in this file:
# every job already runs chore tasks, which is the whole point of them.
#
# The logs are uploaded as artefacts (tier-logs-<job>), `if: always()`
# because the run worth reading is the one that failed -- AND only once
# the job's first tier step has run (`steps.tier.outcome != 'skipped'`).
# A job that dies in setup, the sibling checkout, the fixture download
# or lint has written no tmp/logs/*.log, and an upload refusing an
# empty path would add a second red step hiding the real cause (#306).
# tests/ci_profile.rs holds every such upload to that.
on:
push:
branches:
tags:
# NO BRANCH FILTER ON PULL REQUESTS (#132). With `branches: [main]` a
# pull request based on anything else ran no CI at all — and still
# collected its review-bot ticks, so it read as verified. This
# repository stacks pull requests routinely, a fix branched off a fix
# that has not merged yet, which is exactly the case that got nothing:
# PR #131 came back with one check, its review bot, against PR #130's
# three on the same day.
pull_request:
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CHORE_VERSION: "0.11.0"
jobs:
unit:
name: unit (no tools, no fixtures)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install chore
# Pinned (CHORE_VERSION) and checked against the release's
# checksums: the siblings, the tools and the tests all come
# through it.
run: scripts/ci-install-chore.sh
- name: chore siblings
# rust-fs-core (the path dependency) and fs-linux-test-harness, at
# the refs pinned in chores.yml.
run: chore siblings
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
# restore-keys: any Cargo.lock change (fuzz/Cargo.lock included) misses
# the exact key, and a cold start prints every crate download and
# compile into the tier log -- 714 lines against the unit budget of
# 700, measured on #370, where a warm run prints about 645.
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-unit-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-unit-cargo-
- name: No fixtures are present
run: |
set -euo pipefail
if ls test-disks/*.img >/dev/null 2>&1; then
echo "::error::test-disks/ has images; this job must prove the unit tier needs none"
exit 1
fi
- name: chore test:unit
id: tier
run: chore test:unit
- name: Keep the tier logs
# A quiet tier writes its detail to tmp/logs/<tier>.log and prints a
# verdict; without this the detail dies with the runner and the only
# record left is the one line the terminal got. `if: always()` because
# the run worth reading is the one that failed; not before the tier
# ran, though, or there is no log and this step's red hides the real
# one (#306).
if: always() && steps.tier.outcome != 'skipped'
uses: actions/upload-artifact@v4
with:
name: tier-logs-unit
path: tmp/logs/*.log
if-no-files-found: error
fixtures:
name: fixtures (harness VM, x86_64 KVM)
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Install chore
run: scripts/ci-install-chore.sh
- name: chore siblings
run: chore siblings
- name: KVM, QEMU and Vagrant
id: vm-host
run: ../fs-linux-test-harness/scripts/ci-setup-linux.sh
- name: Cache the Vagrant box
uses: actions/cache@v4
with:
path: ~/.vagrant.d/boxes
key: ${{ steps.vm-host.outputs.box-cache-key }}
- name: chore fixtures
run: chore fixtures
- name: chore vm:status (the VM is down again)
run: '! chore vm:status'
- uses: actions/upload-artifact@v4
with:
name: fixtures
path: test-disks/*.img
if-no-files-found: error
retention-days: 7
test:
name: test (x86_64, oracles in the VM)
needs: fixtures
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- name: Install chore
run: scripts/ci-install-chore.sh
- name: chore siblings
run: chore siblings
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-x86_64-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-x86_64-cargo-
- name: KVM, QEMU and Vagrant
id: vm-host
run: ../fs-linux-test-harness/scripts/ci-setup-linux.sh
- name: Cache the Vagrant box
uses: actions/cache@v4
with:
path: ~/.vagrant.d/boxes
key: ${{ steps.vm-host.outputs.box-cache-key }}
- name: chore tools
run: chore tools
- uses: actions/download-artifact@v4
with:
name: fixtures
path: test-disks
# THE EVIDENCE, NOT THE CLAIM. e2fsprogs cannot be removed from an
# Ubuntu runner — it is essential — so instead every one of its
# programs is replaced with a stub that fails loudly. Nothing this
# job runs may use them: the tools belong to the guest, and a test
# that reached for one here would turn the run red with a message
# saying so, rather than quietly passing on the wrong version.
- name: Make the runner's own e2fsprogs unusable
run: |
set -eu
for tool in debugfs dumpe2fs e2fsck fsck.ext4 mke2fs mkfs.ext4 tune2fs resize2fs; do
path="$(command -v "$tool" 2>/dev/null || true)"
[ -n "$path" ] || continue
sudo mv "$path" "$path.host-copy"
printf '#!/bin/sh\necho "::error::%s ran on the runner; the oracle tools belong in the VM" >&2\nexit 97\n' \
"$tool" | sudo tee "$path" >/dev/null
sudo chmod +x "$path"
echo "poisoned $path"
done
- name: chore lint
run: chore lint
- name: chore test
id: tier
run: chore test
- name: Keep the tier logs
# A quiet tier writes its detail to tmp/logs/<tier>.log and prints a
# verdict; without this the detail dies with the runner and the only
# record left is the one line the terminal got. `if: always()` because
# the run worth reading is the one that failed; not before the tier
# ran, though, or there is no log and this step's red hides the real
# one (#306).
if: always() && steps.tier.outcome != 'skipped'
uses: actions/upload-artifact@v4
with:
name: tier-logs-x86_64
path: tmp/logs/*.log
if-no-files-found: error
- name: chore vm:status (the VM is down again)
run: '! chore vm:status'
test-arm64:
name: test (aarch64, no KVM on this runner)
needs: fixtures
runs-on: ubuntu-24.04-arm
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Install chore
run: scripts/ci-install-chore.sh
- name: chore siblings
run: chore siblings
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-aarch64-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-aarch64-cargo-
- uses: actions/download-artifact@v4
with:
name: fixtures
path: test-disks
- name: chore lint
run: chore lint
- name: chore test:unit
id: tier
run: chore test:unit
# Everything that reads a fixture but needs no VM. The oracle and
# kernel tiers cannot run here — GitHub's arm64 runners have no
# /dev/kvm — and they are not architecture-specific: they read the
# same bytes the x86_64 job's guest reads.
- name: chore test:images
run: chore test:images
- name: Keep the tier logs
# A quiet tier writes its detail to tmp/logs/<tier>.log and prints a
# verdict; without this the detail dies with the runner and the only
# record left is the one line the terminal got. `if: always()` because
# the run worth reading is the one that failed; not before the tier
# ran, though, or there is no log and this step's red hides the real
# one (#306).
if: always() && steps.tier.outcome != 'skipped'
uses: actions/upload-artifact@v4
with:
name: tier-logs-aarch64
path: tmp/logs/*.log
if-no-files-found: error
suite-in-vm:
name: suite in the guest (the macOS path)
needs: fixtures
runs-on: ubuntu-24.04
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
- name: Install chore
run: scripts/ci-install-chore.sh
- name: chore siblings
run: chore siblings
- name: KVM, QEMU and Vagrant
id: vm-host
run: ../fs-linux-test-harness/scripts/ci-setup-linux.sh
- name: Cache the Vagrant box
uses: actions/cache@v4
with:
path: ~/.vagrant.d/boxes
key: ${{ steps.vm-host.outputs.box-cache-key }}
- uses: actions/download-artifact@v4
with:
name: fixtures
path: test-disks
# No Rust on the runner: the toolchain that matters is the one the
# guest installs from rust-toolchain.toml. That is the point of the
# job — on a Mac there is no usable host toolchain for these tests
# either.
- name: chore test:vm
id: tier
run: chore test:vm
- name: Keep the tier logs
# A quiet tier writes its detail to tmp/logs/<tier>.log and prints a
# verdict; without this the detail dies with the runner and the only
# record left is the one line the terminal got. `if: always()` because
# the run worth reading is the one that failed; not before the tier
# ran, though, or there is no log and this step's red hides the real
# one (#306).
if: always() && steps.tier.outcome != 'skipped'
uses: actions/upload-artifact@v4
with:
name: tier-logs-suite-in-vm
path: tmp/logs/*.log
if-no-files-found: error
- name: chore vm:status (the VM is down again)
run: '! chore vm:status'
wasm:
name: wasm32 (browser build, tests under Node)
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install chore
run: scripts/ci-install-chore.sh
- name: chore siblings
run: chore siblings
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-wasm-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-wasm-cargo-
- name: chore tools:wasm
# The wasm32 target, and wasm-bindgen-test-runner at the exact
# wasm-bindgen version Cargo.lock resolved.
run: chore tools:wasm
- name: chore test:wasm
id: tier
run: chore test:wasm
- name: Keep the tier logs
if: always() && steps.tier.outcome != 'skipped'
uses: actions/upload-artifact@v4
with:
name: tier-logs-wasm
path: tmp/logs/*.log
if-no-files-found: error
semver:
# `chore check:semver`: this tree's public API against the newest
# version on crates.io, refusing a break the version in Cargo.toml does
# not declare (#120). No fixtures, no VM -- only the registry.
name: semver (public API against crates.io)
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
# The version scripts/semver-check.sh expects. A prebuilt binary,
# checksum-verified by the action, rather than a ten-minute build.
CARGO_SEMVER_CHECKS_VERSION: "0.50.0"
# A failing tier prints only its verdict by default. Here the tail IS
# the answer -- which items broke -- so it is printed in full.
OUTPUT_BUDGET_FAIL_TAIL: "200"
steps:
- uses: actions/checkout@v4
- name: Install chore
run: scripts/ci-install-chore.sh
- name: chore siblings
run: chore siblings
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-semver-checks
uses: taiki-e/install-action@v2
with:
tool: cargo-semver-checks@${{ env.CARGO_SEMVER_CHECKS_VERSION }}
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-semver-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-semver-cargo-
- name: chore check:semver
id: tier
run: chore check:semver
- name: Keep the tier logs
# Not before the tier ran: there is no log then, and this step's red
# would hide the real one (#306).
if: always() && steps.tier.outcome != 'skipped'
uses: actions/upload-artifact@v4
with:
name: tier-logs-semver
path: tmp/logs/*.log
if-no-files-found: error
msrv:
name: msrv (Cargo.toml rust-version)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install chore
run: scripts/ci-install-chore.sh
- name: chore siblings
run: chore siblings
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target/msrv
key: ${{ runner.os }}-msrv-cargo-${{ hashFiles('**/Cargo.lock', 'Cargo.toml') }}
restore-keys: ${{ runner.os }}-msrv-cargo-
- name: chore check:msrv
# The script installs the toolchain rust-version names; the runner's
# rustup is all it needs.
run: chore check:msrv
cli:
name: cli (the installed tools, on PATH)
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install chore
run: scripts/ci-install-chore.sh
- name: chore siblings
run: chore siblings
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cli-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cli-cargo-
- name: chore cli:install
run: chore cli:install
# FIRST on PATH, ahead of the runner's own /usr/sbin/mkfs.ext4 and
# fsck.ext4 -- which doctor then reports as present and not run.
- name: The staged tools first on PATH
run: scripts/cli-install.sh --print-bin-dir >> "$GITHUB_PATH"
- name: chore test:cli
id: tier
run: chore test:cli
# THE RELEASE TARBALL, built here so a release is not the first time
# it is put together: rust-fs-core's package-cli, run through
# scripts/core.sh as release.yml's called workflow runs it, stages the
# install prefix Cargo.toml's [package.metadata.package-cli] declares
# from the binary cli:install built, then refuses it unless it holds
# exactly that layout, every dotted name is a relative symlink to
# bin/rust-fs-ext4, every name has its man page and completions,
# CAVEATS is at most four lines, and every name answers --version as
# this crate at Cargo.toml's version.
- name: The release tarball has the install layout
run: |
set -euo pipefail
version="$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -n 1)"
mkdir -p tmp/package
cd tmp/package
tarball="$(bash ../../scripts/core.sh package-cli "$version" linux-x86_64 "${CARGO_TARGET_DIR:-$GITHUB_WORKSPACE/target}/release" | tail -n 1)"
tar -tzvf "$tarball"
- name: Keep the tier logs
# Not before the tier ran: there is no log then, and this step's red
# would hide the real one (#306).
if: always() && steps.tier.outcome != 'skipped'
uses: actions/upload-artifact@v4
with:
name: tier-logs-cli
path: tmp/logs/*.log
if-no-files-found: error
provenance:
name: provenance (no kernel or e2fsprogs internals named)
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install chore
run: scripts/ci-install-chore.sh
- name: chore check:provenance
run: chore check:provenance
ci-ok:
name: ci-ok
if: always()
needs:
runs-on: ubuntu-latest
steps:
- name: Every job ran and succeeded
env:
NEEDS: ${{ toJSON(needs) }}
run: |
set -euo pipefail
echo "$NEEDS" | jq -r 'to_entries[] | "\(.key): \(.value.result)"'
bad="$(echo "$NEEDS" | jq -r '[to_entries[] | select(.value.result != "success") | .key] | join(", ")')"
if [ -n "$bad" ]; then
echo "::error::not green: $bad (failed, cancelled or skipped)"
exit 1
fi
echo "all required jobs succeeded"