Skip to content

release.yml: a compile cache for release builds (sccache on R2) - #138

Merged
shinyobjectz merged 1 commit into
mainfrom
release-cache
Nov 13, 2026
Merged

shinyobjectz merged 1 commit into
mainfrom
release-cache

Conversation

@shinyobjectz

@shinyobjectz shinyobjectz commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

A release candidate's build compiles everything cold, about three hours on the Mac (0.1.2's rc5 took 3h04m), even after a one-line change. This adds a compile cache so a candidate compiles only the crates that changed and the ones above them.

Why R2 and not GitHub's cache. A tag's run can read only its own tag's caches and the default branch's, so rc3's cache would never reach rc4. The repo's 10 GB of Actions cache is also already full with CI's (15.6 GB active).

What it does

  • sccache (mozilla-actions/sccache-action) in the Mac, Linux and Windows build jobs, on the R2 bucket raea-build-cache, with each OS and architecture under its own prefix. A 45-day lifecycle rule bounds the bucket's size.
  • C and C++ in build scripts are cached too, through cc-rs and CMake's compiler launchers.
  • If the bucket can't be reached or written, the build runs uncached as before (tools/release/compile-cache.sh), and a fork with no secrets runs uncached. Tried against bad keys: sccache refuses to start, and the step warns and moves on.
  • Each cargo call's minutes show as a notice on the run, and sccache's stats print after the build, so the next candidate shows what the cache saved.

Not cached: thin-LTO linking and build scripts' runs. How much of the 3 hours they are is what the first warm run will show.

Set up (11-13): the bucket raea-build-cache (raea's Cloudflare account, a 45-day expiry) and an account token scoped to that bucket only (Workers R2 Storage Bucket Item Read and Write), as the secrets RELEASE_CACHE_ENDPOINT, RELEASE_CACHE_KEY_ID and RELEASE_CACHE_SECRET. Checked from the Mac through sccache 0.19: the server starts on the bucket, a release-profile build writes its entries, no write errors.

Proof after merge: a dry run (workflow_dispatch, dry_run, a tag, no promote) fills the cache; a second one with the cache warm gives the numbers.

…ket (raea-build-cache), so a candidate after a small change compiles only what changed instead of three cold hours. GitHub's own cache can't carry it: a tag's run reads only its own tag's caches and the default branch's, so rc3's would never reach rc4, and the repo's 10 GB are CI's. tools/release/compile-cache.sh turns it on when the job has the bucket's key (secrets RELEASE_CACHE_ENDPOINT, RELEASE_CACHE_KEY_ID, RELEASE_CACHE_SECRET), each OS and architecture under its own prefix, C and C++ in build scripts through cc-rs and CMake's launchers; when the bucket can't be reached or written the build runs uncached, as before. Each cargo call's minutes are a notice on the run, and sccache's hits and misses are printed after the build. Linking (thin LTO) and build scripts' runs aren't cached
@shinyobjectz
shinyobjectz merged commit c96de52 into main Nov 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant