You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6ca2776
Browse filesBrowse the repository at this point in the historyBrowse files
ci: keep the Linux Nix store on a Blacksmith sticky disk (#1882)
* ci(release): shallow-clone the tag in native build jobs
The native build jobs checked out the release tag with fetch-depth: 0,
but nothing in the build path reads git history: CI builds the same
outputs from a default shallow checkout. The full clone cost up to 41s
on build-windows-x64 in run 38470996208, which finished within 20s of
the slowest leg.
* ci: keep the Linux Nix store on a Blacksmith sticky disk
The cache-nix-action store cache misses most of the time. Across ~25
CI pushes to main between 2026-09-25 and 2026-10-13, the native build
legs restored an entry in only 3-6 of ~19 runs each (macOS and Linux
alike), and a hit roughly halves the build step (linux-arm64: 82s vs
213s). Blacksmith's Actions cache allows 25 GB per repository per week
with LRU eviction, while the per-commit keys introduced in #1296 write
a fresh 1.3-3 GB entry for every job on every run: ~12 GB per push to
main, ~6 GB per PR run, up to 2.5 GB per hourly update-pricing run.
#1296 assumed the backend was effectively unlimited; it is not. Even
on a hit, restoring takes ~60s and the post-job save another ~40s.
On Blacksmith Linux runners, mount /nix from a sticky disk instead. A
job gets a copy-on-write clone of the last committed snapshot, so the
whole store is present at mount time with no restore or save step and
nothing counted against the cache quota. macOS and GitHub-hosted
runners have no sticky disks and keep using cache-nix-action.
#1296 dropped an earlier sticky-disk setup. This one avoids its
problems:
- Keys are per job and matrix leg but carry no workflow name, so
release.yaml's build-native-packages mounts the disk ci.yaml keeps
warm on every push to main instead of starting cold. autofix, which
only runs on pull requests and so would never commit, borrows
preflight's disk via the new disk-job input; both build the treefmt
closure.
- The old trim dropped Crane's cargoArtifacts because nothing rooted
them (#1274, #1279). The Linux build now roots them inside
/nix/var/nix/gcroots, which persists with the disk, and
keep-derivations/keep-outputs make GC keep their build-time closure
(toolchain, vendored sources) too.
- The weekly GC workflow (#1295) mounted its own disk and never touched
the real ones. Trimming now happens in the job that commits: once the
disk is over half full, `nix-collect-garbage --delete-old` runs before
the job adds to the store. Jobs without persistent roots go cold once
per trim.
Only runs on main that are not pull_request(_target) events commit,
whatever `save` says, so pull request code (including forks) can read
main's store but never write the store that main and releases build
from. cache-nix-action keeps its existing behaviour, now also gated by
`save`.
Not confirmed from Blacksmith's documentation: the disk's capacity
(hence the relative threshold and the `df` log on every run) and which
snapshot wins when two runs commit the same key concurrently. Either
outcome is a valid store for a cache.
* ci(release): stop persisting the Nix store from release builds
Release builds now mount the Linux sticky disk that CI commits on every
push to main. Committing it from the release as well would only race
those commits with an equivalent store.
On macOS, the release's own cache-nix-action entries never survive to
the next release under Blacksmith's cache eviction, yet each save took
~40s (build-mac-arm64 and build-mac-x64 in run 38470996208) before the
job could finish and let the npm job start.
Add a save-nix-cache input to both native build actions, forwarded to
setup-nix-cache, skip rooting the Crane artifacts when nothing will be
saved, and pass save-nix-cache: false from release.yaml.
* ci: mount test's Nix sticky disk in the perf comment legs
ccusage-perf-comment only runs on pull requests, and pull requests
never commit a sticky disk, so its own per-leg keys would stay freshly
formatted on every run. Mount the disk test commits on every push to
main instead: it installs `just` and resolves the same flake inputs.
Both legs mount it read-only, so the per-runtime cache-scope that kept
their saves apart is no longer needed.
Reported by pullfrog in review.
0 commit comments