pub const SCCACHE_DIR: &str = "/sccache";Expand description
Where sccache keeps compiled units inside the builder: a BuildKit cache mount, never layer content. Two caches with two jobs, because neither does the other’s:
- the
depslayer travels with a registry cache export, so a fresh runner gets every dependency compiled while the lockfile is unchanged — and loses all of them the moment it changes; - the sccache mount is keyed by each compilation’s own inputs, so when the lockfile moves only the crates that actually changed recompile, and it is shared by every build on one builder whatever directory it was started from — every worktree and branch on a machine. A mount never leaves its builder: on an ephemeral runner the workflow carries it in and out explicitly, or it starts empty, which is slower and never wrong.
A unit sccache cannot see the whole of is compiled, not guessed: the package itself, whose sources and commit change with every build, is a miss by construction, and the image’s smoke test checks the commit it names against the one it was built from.