diff --git a/.fabrica/artifex/layers.yaml b/.fabrica/artifex/layers.yaml new file mode 100644 index 0000000..18564ff --- /dev/null +++ b/.fabrica/artifex/layers.yaml @@ -0,0 +1,39 @@ +# Ianitor Domi: the five test layers (ROADMAP §5) on a push to main, or by hand. Layer 1 (the differential +# suite against Caddy) runs inside the workspace tests; layer 2 is scripts/conformance.sh (h2spec, testssl.sh); +# layer 3 tests/fuzz/run.sh (cargo-fuzz, 2 minutes a target; any crash fails); layer 4 the NixOS VM tests; +# layer 5 scripts/bench.sh (load and a 5-minute soak against Caddy; results kept as artifacts). +# Runner: label `nixos`, on a host with /dev/kvm and Nix's `kvm` system feature (the VM tests; on Hyper-V, +# nested virtualisation on), outbound HTTPS (crates.io, cache.nixos.org) and about 20 GB free. Every tool comes +# from the flake's `ci` shell, so the runner needs only Nix with flakes. +name: layers +on: + push: [main] + manual: true +runner: nixos +env: + CARGO_TERM_COLOR: "never" + CARGO_BUILD_JOBS: "8" +steps: + - id: workspace-tests + run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c cargo test --workspace --no-fail-fast + - id: conformance + needs: [workspace-tests] + run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c scripts/conformance.sh + artifacts: ["bench/conformance/*"] + - id: fuzz + needs: [workspace-tests] + run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c tests/fuzz/run.sh 120 + - id: vm-apply-reverts + nix: .#checks.x86_64-linux.vm-apply-reverts + - id: vm-engine-switch + nix: .#checks.x86_64-linux.vm-engine-switch + - id: vm-intermediate-renewal + nix: .#checks.x86_64-linux.vm-intermediate-renewal + - id: vm-control-loopback + nix: .#checks.x86_64-linux.vm-control-loopback + - id: vm-sockets + nix: .#checks.x86_64-linux.vm-sockets + - id: load + needs: [conformance, fuzz] + run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c scripts/bench.sh fabrica-runner + artifacts: ["bench/results/**"] diff --git a/.fabrica/artifex/release.yaml b/.fabrica/artifex/release.yaml index d27452f..d2aa08c 100644 --- a/.fabrica/artifex/release.yaml +++ b/.fabrica/artifex/release.yaml @@ -1,7 +1,7 @@ # Ianitor Domi: the Gitea release of a v* tag (docs/release.md, docs/fabrica.md). Ianitor ships no binary (the server # builds it with Nix and the deploy pipeline switches it in), so a release is the source archive of the tag, its notes, -# the screenshots of the web UI and the Aula page, all under a SHA256SUMS signed by domi-release through Custos; -# release-notes.md is also the release's text on Gitea. +# the screenshots of the web UI, the Aula page and the Nix pin, all under a SHA256SUMS signed by domi-release through +# Custos; release-notes.md is also the release's text on Gitea. # The Windows runner (the Fabrica app on Mark's PC) runs it: `fabrica`, node and pnpm are on every step's PATH. # No Gitea webhook to the hub yet: a pushed tag is started on demand (the hub's POST /api/runs, ref v). # The web UI's e2e suite (apps/web/playwright.config.ts) runs the main flows and takes the pictures in the installed @@ -10,6 +10,10 @@ # Playwright's ffmpeg (the flows' videos) is in PLAYWRIGHT_BROWSERS_PATH, set here so the step does not depend on the # runner's environment: F:\ms-playwright on Mark's PC, never C:. Nothing is downloaded during a release; a runner # without it fails the e2e step with Playwright's "Executable doesn't exist" naming the path. +# `pin` publishes the Nix build's NAR hashes (.fabrica/nix/pin.json, written by scripts/nix-pin.sh on Linux at a +# clean commit and committed before the tag) as ianitor-nix.json, and refuses a pin made from other code than the +# tag's (its recorded source tree must be the tag's); that check is the gate, since pipelines cannot depend on one +# another. The `verify-nix` pipeline rebuilds the tag on the NixOS runner and compares (docs/verify.md). name: release on: tag: "v*" @@ -49,9 +53,15 @@ steps: needs: [notes, shots] run: fabrica aula page artifacts: ["target/aula/aula-page.json", "target/aula/aula-page.html"] + - id: pin-test + run: node --test scripts/release-pin.test.mjs + - id: pin + needs: [version, pin-test] + run: node scripts/release-pin.mjs ${{ version }} ${{ tag }} ${{ commit }} + artifacts: ["target/nix/ianitor-nix.json"] - id: approve - needs: [source, page] - approve: "Publish Ianitor ${{ tag }}: its source, notes and screenshots?" + needs: [source, page, pin] + approve: "Publish Ianitor ${{ tag }}: its source, notes, screenshots and Nix pin?" - id: publish needs: [approve] publish: @@ -63,4 +73,5 @@ steps: - "**/aula-*.png" - "**/aula.json" - "**/aula-page.json" + - "**/ianitor-nix.json" sums: domi-release diff --git a/.fabrica/artifex/verify-nix.yaml b/.fabrica/artifex/verify-nix.yaml new file mode 100644 index 0000000..e94d209 --- /dev/null +++ b/.fabrica/artifex/verify-nix.yaml @@ -0,0 +1,18 @@ +# Ianitor Domi: the verifiable build (docs/verify.md). On a v* tag the NixOS runner builds .#ianitor and +# .#ianitor-web from the tag (the run record keeps each output's store path and NAR hash), rebuilds each output +# derivation once more, and compares with the pin the release publishes (.fabrica/nix/pin.json at the tag: the +# source tree, nixpkgs and every hash); any difference fails the run. Runner: label `nixos`, Nix with flakes, +# node and jq from the `ci` shell; no KVM needed. +name: verify-nix +on: + tag: "v*" + manual: true +runner: nixos +steps: + - id: ianitor + nix: .#ianitor + - id: web + nix: .#ianitor-web + - id: pin + needs: [ianitor, web] + run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c scripts/nix-pin.sh --check diff --git a/CLAUDE.md b/CLAUDE.md index 1a2b160..dff64d5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -14,7 +14,8 @@ tests/diff same requests against Ianitor and Caddy, responses compared. tests/support shared test fixtures (test CA, upstreams, mock Authelia, clients); test-only. tests/fuzz cargo-fuzz targets. deploy/nixos NixOS module + VM tests. -scripts the release's version check. Releases (notes, screenshots): docs/release.md. +scripts version check, release pin, test layers 2 and 5 (conformance, bench), the Nix pin. Releases: docs/release.md. +bench layer 5 results as data (CSV/JSON), layer 2 outputs. ## Commands cargo test --workspace # quote test counts per crate; an exit code alone is not green @@ -23,12 +24,20 @@ pnpm --filter web dev # 127.0.0.1 only, never --host pnpm --filter web test:e2e # the web UI's flows in Edge on demo data, recorded -> target/e2e/videos (docs/fabrica.md) pnpm --filter web aula:shots # the Aula screenshots from the same suite -> target/e2e/aula; then `fabrica aula shots` node scripts/check-version.mjs X.Y.Z # Cargo.toml and both package.json carry the version +scripts/conformance.sh # layer 2: h2spec + testssl.sh, Ianitor vs Caddy (nix develop .#ci) +tests/fuzz/run.sh 60 # layer 3: cargo-fuzz, 60 s a target; crashes become regressions +scripts/bench.sh