The gate owns its build directories - #76
Merged
Merged
Conversation
rust-cache keeps the cargo home; `actions/cache` keeps `target` and `.deps/iroh/target` whole. The action's own target caching cannot serve this gate: it saves a build directory only after deleting every package whose manifest lives inside the workspace root, which is every crate the gate spends its time on — ours and the pinned checkouts'. Keeping the workspace members (#75) did not help, because they sit on top of the path dependencies it still deleted, and a missing dependency output rebuilds everything above it. Even among the packages it keeps, artifacts whose file name carries no build hash are dropped: cargo's own `deps/libiroh_relay.rlib` was the reason the relay rebuilt every run. A green gate is what justifies saving, so the save runs after it, on main only, and only when the restore did not already hold the key. A key that misses still restores the newest entry under the `build-dirs-` prefix, so cargo rebuilds what changed rather than everything. Measured on this branch, seeded and then re-run: the gate compiles nothing and takes 3m12, against 7m28 before; the two cache entries together are 1.85 GB where the single one was 1.78 GB, and restoring them costs 26s.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Swatinem/rust-cachekeeps the cargo home (cache-targets: false);actions/cachekeepstargetand.deps/iroh/targetwhole, restored before the gate and saved after it on main.Why #75 did not deliver
#75 landed the mtime half correctly — probe run 31730990571 shows sources dated by their commits (
iroh-relay/src/lib.rsat 2026-06-11) and restored artifacts newer (18:12 the same day) — but the gate still compiled 27 crates and stayed at 7m28. The fingerprint log gives the reason, and it is not staleness:Missing outputs, not old ones. Three ways the action's target caching removes them:
target/host/.fingerprintheld our two members and nothing from.deps— noiroh, noiroh-relay, no sibling host crates.cache-workspace-crates(from In-repo build artifacts survive the CI cache #75) adds back the members, but they sit on top of those path dependencies, so they rebuilt anyway — theStaleDepFingerprintcascade.-<hash>, so artifacts cargo emits without one are dropped regardless (deps/libiroh_relay.rlib), as are bin artifacts whose target name differs from the package name (endpoint_demo-…; the metadata filter dropsbinkinds).None of these is configurable, so the gate keeps its own build directories.
Measured, on this branch, before asking for a merge
A seeding run and then a re-run against it (31731856587, then 31733485940):
The gate is now its tests: matrix (13 rows), the deltic exam (7 pass), and bench, all green in that run with nothing to build.
The verification used a temporary branch allowlist on both save conditions, removed before this PR (the commit here is main-only). Removing it changes
ci.yml, which is in both keys, so this PR's run and the first run on main are cold and re-seed; the run after that is the steady state above.Notes
restore-keys: build-dirs-still restores the newest entry, so a key rotation costs an incremental rebuild rather than a cold one.