Repository navigation
[NO-JIRA] Bump honk flake input for tail/list legibility (honk#77) #3228
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| jobs: | |
| check: | |
| # The single-entry matrix is deliberate and load-bearing: it is what makes | |
| # this job report as "check (ubuntu-24.04-arm)", which is the exact context | |
| # branch protection requires. Inlining `runs-on: ubuntu-24.04-arm` and | |
| # dropping the matrix would rename the job to plain "check", the required | |
| # context would never report, and every PR would block forever waiting on | |
| # it. Renaming means updating branch protection in the same breath. | |
| # | |
| # There used to be a second `ubuntu-latest` leg. It was a leftover of the | |
| # Crostini (x86_64-linux) target removed in 4d19e88: the flake exposes no | |
| # x86_64-linux outputs, so `nix flake check` there built nothing and merely | |
| # confirmed the flake evaluates, while presenting a green check that | |
| # implied coverage it did not have. Removed once the matching required | |
| # context was dropped from branch protection. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| env: | |
| # Flake checks whose transitive closure contains private binaries | |
| # (claude-failover-proxy, cfp-shaper). Space-separated. | |
| # | |
| # RULE: Any check whose closure includes private release assets must be | |
| # listed here. Public checks are built and the Actions Nix-store cache is | |
| # saved BEFORE any private asset enters the store. Private checks are only | |
| # built afterward, guaranteeing that private binaries are never stored in | |
| # GitHub Actions caches on this public repository. | |
| PRIVATE_CHECKS: "nixos-cloudbox nixos-devbox" | |
| # Kept generous deliberately. Two layers now cut the cost -- the devenv | |
| # substituter and the Nix-store cache below -- but a cache MISS (first run on | |
| # a new key with no prefix match, or after a purge) still pays the full cold | |
| # build, so the bound has to cover the uncached case rather than the happy one. | |
| timeout-minutes: 90 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # devenv is a Rust program built as per-crate derivations, it is pulled into | |
| # BOTH home configs (flake.nix -> users/dev/home.base.nix), and nothing in | |
| # cache.nixos.org substitutes it -- so every cold CI run compiled ~579 | |
| # rust_* crates from source. That was the bulk of a ~50 minute check. | |
| # devenv publishes a PUBLIC cache; adding it as a substituter needs no | |
| # secret and does not weaken the gate, because trust is still by signing | |
| # key. Verified before adding: our exact pin | |
| # (devenv-wrapped-2.1.3, m66qfslh...) returns HTTP 200 from | |
| # devenv.cachix.org and 404 from cache.nixos.org, and the key below is the | |
| # one the cachix API reports for the cache AND the one that signed that | |
| # path's narinfo. | |
| # | |
| # gamebox's devenvPkg (x86_64) is import-from-derivation of an x86_64-only | |
| # drv (cabal2nix-cachix, preferLocalBuild, allowSubstitutes=false) that | |
| # the aarch64 runner cannot build; it is on devenv.cachix.org but nix only | |
| # substitutes preferLocalBuild/allowSubstitutes=false drvs when | |
| # always-allow-substitutes = true. | |
| # Local equivalent: nix flake check --keep-going --option always-allow-substitutes true (on devbox/cloudbox). | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@v14 | |
| with: | |
| extra-conf: | | |
| extra-substituters = https://devenv.cachix.org | |
| extra-trusted-public-keys = devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw= | |
| always-allow-substitutes = true | |
| # The remaining cost after the devenv substituter was this repo's own | |
| # uncached builds, and wrangler dominated them: measured 5.9 of 12.2 minutes | |
| # (49%) on run 30566609050, because wrangler-4.62.0 is 404 on cache.nixos.org | |
| # for aarch64-linux -- Hydra does not build it -- so pnpm-deps, the DTS build, | |
| # auto-patchelf and fixup all ran from source every time. | |
| # | |
| # This uses the GitHub Actions cache as a Nix store cache, which needs NO | |
| # external account and NO secret, unlike Cachix. A self-hosted runner would be | |
| # faster still but GitHub advises against them on PUBLIC repositories, since a | |
| # fork PR can execute arbitrary code on the runner. | |
| # | |
| # RESTORE STEP: Restores cached store paths. The corresponding SAVE step runs | |
| # explicitly later in the workflow, strictly BEFORE any private release asset | |
| # enters the store. | |
| - name: Restore the Nix store cache | |
| uses: nix-community/cache-nix-action/restore@v7.0.2 | |
| with: | |
| primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock', '**/*.nix') }} | |
| restore-prefixes-first-match: nix-${{ runner.os }}- | |
| - name: Secret and SOPS-encryption guard | |
| run: | | |
| set -euo pipefail | |
| python3 scripts/check-sops-encrypted.py | |
| bash scripts/test-check-sops-encrypted.sh | |
| bash scripts/test-share-to-agent.sh | |
| nix shell --inputs-from . nixpkgs#gitleaks -c \ | |
| gitleaks detect --source . --no-git --redact --no-banner | |
| - name: Disk space before | |
| run: df -h / | |
| # Build all public checks before saving the cache. | |
| # | |
| # Every check in .#checks.<system> except those listed in $PRIVATE_CHECKS is | |
| # built here with an indirect gcroot under /tmp/ci-gcroots/<name>. This | |
| # realizes all public check closures and pins them so the pre-save cache GC | |
| # preserves them. Checks with private dependencies (nixos-cloudbox, nixos-devbox) are | |
| # skipped here and built only after the cache has been saved. | |
| - name: Build public checks | |
| run: | | |
| set -euo pipefail | |
| arch=$(uname -m) | |
| case "$arch" in | |
| x86_64) system="x86_64-linux" ;; | |
| aarch64|arm64) system="aarch64-linux" ;; | |
| *) system="$arch-linux" ;; | |
| esac | |
| checks=$(nix eval --json ".#checks.${system}" --apply 'builtins.attrNames' 2>/dev/null || echo "[]") | |
| mkdir -p /tmp/ci-gcroots | |
| failed=0 | |
| for name in $(echo "$checks" | jq -r '.[]'); do | |
| is_private=false | |
| for priv in $PRIVATE_CHECKS; do | |
| if [ "$name" = "$priv" ]; then | |
| is_private=true | |
| break | |
| fi | |
| done | |
| if [ "$is_private" = "true" ]; then | |
| echo "Skipping private check: $name (will build after cache save)" | |
| continue | |
| fi | |
| echo "Building public check: .#checks.${system}.${name}..." | |
| if ! nix build --print-build-logs --keep-going -o "/tmp/ci-gcroots/$name" ".#checks.${system}.${name}"; then | |
| echo "::error::Build failed for public check: $name" | |
| failed=1 | |
| fi | |
| done | |
| if [ "$failed" -ne 0 ]; then | |
| echo "::error::One or more public checks failed to build." | |
| exit 1 | |
| fi | |
| ls -l /tmp/ci-gcroots/ | |
| # Pre-save tripwire: | |
| # Assert that no private binaries exist in /nix/store before saving the | |
| # cache. If a public check silently grew a private dependency, this fails | |
| # closed and aborts the job before the save step runs. | |
| - name: Verify no private binaries in store before cache save | |
| run: | | |
| set -euo pipefail | |
| shopt -s nullglob | |
| matches=(/nix/store/*-claude-failover-proxy-* /nix/store/*-cfp-shaper-*) | |
| shopt -u nullglob | |
| if [ ${#matches[@]} -gt 0 ]; then | |
| echo "::error::Tripwire fired: private binaries found in Nix store before cache save!" | |
| printf '%s\n' "${matches[@]}" | |
| exit 1 | |
| fi | |
| echo "Store is clean: no private binaries found." | |
| # Save the Nix store cache on main. | |
| # | |
| # Crucially, this runs BEFORE any private release asset is pre-seeded or built. | |
| # The store at this point contains only public check outputs and their | |
| # dependencies. | |
| # | |
| # The store is GC'd to ~7GB before saving because the Actions cache quota is | |
| # 10GB per repo and an ungarbage-collected store exceeds it. Old entries are | |
| # purged so a stale cache cannot silently squat the quota and starve new saves. | |
| - name: Save the Nix store cache | |
| if: github.ref == 'refs/heads/main' | |
| uses: nix-community/cache-nix-action/save@v7.0.2 | |
| with: | |
| primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock', '**/*.nix') }} | |
| gc-max-store-size-linux: 7000000000 | |
| purge: true | |
| purge-prefixes: nix-${{ runner.os }}- | |
| purge-created: 604800 | |
| purge-primary-key: never | |
| # Pre-seed private FOD sources for nixos-cloudbox and nixos-devbox. | |
| # | |
| # Now that the store cache has been saved, we can safely introduce private | |
| # release assets. In CI, we use the CFP_READ_TOKEN secret to download the | |
| # assets via the GitHub API and add them to the Nix store as fixed-output | |
| # derivations. Once added, Nix sees the FODs as already realised and does | |
| # not attempt an unauthenticated fetch. | |
| # | |
| # Fork PRs do not have access to repository secrets; fail loudly with a | |
| # clear message rather than a confusing 404. | |
| - name: Pre-seed private release assets | |
| env: | |
| GH_TOKEN: ${{ secrets.CFP_READ_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${GH_TOKEN:-}" ]; then | |
| echo "::error::CFP_READ_TOKEN secret is empty or unset." | |
| echo "Fork PRs do not receive repository secrets and cannot pre-seed private assets for private checks (nixos-cloudbox, nixos-devbox)." | |
| exit 1 | |
| fi | |
| sources=$(nix eval --json '.#claude-failover-proxy.passthru.privateSources') | |
| tmpdir=$(mktemp -d) | |
| trap 'rm -rf "$tmpdir"' EXIT | |
| while IFS= read -r src; do | |
| [ -z "$src" ] && continue | |
| name=$(echo "$src" | jq -r '.name') | |
| url=$(echo "$src" | jq -r '.url') | |
| expected_path=$(echo "$src" | jq -r '.storePath') | |
| echo "Fetching private FOD source $name from $url..." | |
| gh api -H 'Accept: application/octet-stream' "$url" > "$tmpdir/$name" | |
| actual_path=$(nix-store --add-fixed sha256 "$tmpdir/$name") | |
| rm -f "$tmpdir/$name" | |
| echo " Expected: $expected_path" | |
| echo " Actual: $actual_path" | |
| if [ "$actual_path" != "$expected_path" ]; then | |
| echo "::error::Pre-seeded store path mismatch for $name: expected $expected_path, got $actual_path" | |
| exit 1 | |
| fi | |
| echo "Successfully pre-seeded $name -> $actual_path" | |
| done < <(echo "$sources" | jq -c '.[]') | |
| # --print-build-logs is not cosmetic. Without it a failing derivation | |
| # prints only "For full logs, run: nix log /nix/store/...drv", and that | |
| # store path dies with the runner -- leaving a red check with no way to | |
| # see WHY. The failure this gate exists to catch (shellcheck rejecting a | |
| # writeShellApplication) is legible only in the build log. | |
| # --keep-going reports every broken configuration in one run instead of | |
| # stopping at the first. | |
| # | |
| # Do NOT add --no-build here, and do not reach for it locally either. | |
| # nixpkgs' nixos/modules/virtualisation/google-compute-config.nix does | |
| # boot.extraModprobeConfig = | |
| # readFile "${pkgs.google-guest-configs}/etc/modprobe.d/gce-blacklist.conf"; | |
| # which is import-from-derivation: cloudbox cannot finish EVALUATING | |
| # until google-guest-configs has actually been BUILT, because readFile | |
| # has to read a file out of its output. --no-build forbids exactly that | |
| # build, so nix cannot realise the path's context and aborts with | |
| # error: path '/nix/store/...-google-guest-configs-<ver>.drv' is not valid | |
| # That message names a store path, so it reads like GC damage or a | |
| # corrupt store. It is not. It means "you told me not to build, and I | |
| # needed to build." | |
| # | |
| # The tell, if you ever see it: run the check again WITHOUT --no-build | |
| # once. After that the IFD dependency is realised, and --no-build starts | |
| # passing on the very same tree with no source change. | |
| - name: Run nix flake check | |
| run: nix flake check --print-build-logs --keep-going | |
| # The ONE suite in this repo that cannot be a nix check, and the reason | |
| # channel (b) exists in users/dev/test-unwired-tests.sh. | |
| # | |
| # pkgs/ask-question/test.sh asserts properties OF A DERIVATION: that the | |
| # deps stage has no bun in its inputDrvs, that it is not a fixed-output | |
| # derivation, that drvPath is stable across two SEPARATE evaluations, and | |
| # that the built CLI vendors undici. It therefore runs `nix eval`, `nix | |
| # derivation show` and `nix build` itself, none of which work inside a | |
| # build sandbox -- so it is wired here instead, which the guard blesses. | |
| # | |
| # Rewriting it into eval-time assertions inside flake.nix was considered | |
| # and rejected: an assert on `nativeBuildInputs` is strictly WEAKER than | |
| # jq over the real drv's inputDrvs (bun can re-enter through any attr or | |
| # wrapper and the drv-level check still sees it), and the two-process | |
| # drvPath comparison cannot be expressed inside a single evaluation at | |
| # all. That trade would have deleted one invariant and quietly weakened | |
| # another while claiming the same coverage. | |
| # | |
| # `if: always()` mirrors --keep-going above: when both this and the flake | |
| # check are broken, one run should report both rather than hiding this | |
| # behind the first failure. | |
| - name: Run the ask-question derivation-invariant suite (cannot be hermetic) | |
| if: always() | |
| run: bash pkgs/ask-question/test.sh | |
| # The plugin-bundle family, for the same reason as ask-question above: | |
| # these assert properties OF A DERIVATION -- no bun in the deps stage's | |
| # inputDrvs, deps stage is not a fixed-output derivation, drvPath stable | |
| # across two SEPARATE evaluations -- so they run `nix eval`, `nix | |
| # derivation show` and `nix build` themselves and cannot nest in a build | |
| # sandbox. workstation-m98t's own description prescribed injecting the | |
| # built artifact via an env var, the seam used for the oo4q suites; that | |
| # was wrong here, because it covers only the three artifact-level | |
| # invariants and deletes the three derivation-level ones the bead exists | |
| # for. Note the package DOES have doCheck=true and a real checkPhase that | |
| # runs in CI inside the home closures, but that checkPhase is a bun-load | |
| # smoke test and does not run test.sh -- the oc-session-list trap, and why | |
| # the reachability guard refuses checkPhase as evidence. | |
| # | |
| # Only the two shims are named. The shared runner they exec is credited by | |
| # the guard's transitive closure, which as of this commit can finally parse | |
| # their `$(dirname "${BASH_SOURCE[0]}")` delegation (meta-test case 7b). | |
| - name: Run the plugin-bundle derivation-invariant suites (cannot be hermetic) | |
| if: always() | |
| run: | | |
| bash pkgs/session-state-plugin/test.sh | |
| bash pkgs/self-compact-plugin/test.sh | |
| - name: Disk space after | |
| if: always() | |
| run: df -h / | |
| # Advisory macOS (aarch64-darwin) build of public third-party packages. | |
| # | |
| # Catches Darwin-only hash and build breaks (e.g. fetchPnpmDeps producing a | |
| # different hash on aarch64-darwin, as in #977 for mcp-remote) before merge. | |
| # | |
| # Deliberately NOT in branch protection required contexts (advisory), and | |
| # deliberately DOES NOT save to the GitHub Actions Nix store cache: | |
| # - Linux's `check` job already uses ~7 GB of the 10 GB repo cache quota. | |
| # - `checks.aarch64-darwin` (`home-mac`, `darwin-system`) includes private | |
| # claude-failover-proxy assets and is NOT built here. | |
| darwin-packages: | |
| runs-on: macos-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@v14 | |
| - name: Build public Darwin packages | |
| run: | | |
| set -euo pipefail | |
| pkgs=( | |
| mcp-remote | |
| figma-mcp-server | |
| dvc | |
| slack-mcp-server | |
| beads | |
| bb | |
| gws | |
| gclpr | |
| terraform | |
| ask-question | |
| opencode-frontdoor | |
| ) | |
| targets=() | |
| for p in "${pkgs[@]}"; do | |
| targets+=(".#packages.aarch64-darwin.${p}") | |
| done | |
| nix build --no-link --print-build-logs --keep-going "${targets[@]}" | |
| - name: Verify no private binaries entered store | |
| run: | | |
| set -euo pipefail | |
| shopt -s nullglob | |
| matches=(/nix/store/*-claude-failover-proxy-* /nix/store/*-cfp-shaper-*) | |
| shopt -u nullglob | |
| if [ ${#matches[@]} -gt 0 ]; then | |
| echo "::error::Tripwire fired: private binaries found in Nix store!" | |
| printf '%s\n' "${matches[@]}" | |
| exit 1 | |
| fi | |
| echo "Store is clean: no private binaries found." |