ci: fix the Go build cache never being hit - #1732
Open
u9g wants to merge 1 commit into
Open
Conversation
|
biglittlebigben
approved these changes
Aug 22, 2026
davidzhao
approved these changes
Aug 22, 2026
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.
The
Testjob compiles the module from scratch on every run, because neither of the two caches configured here has ever produced a hit.The
actions/cachestep used a constant key.key: livekit-protocolnever changes, andactions/cachedoes not re-save on a hit, so the entry stayed frozen at whatever it held when first written. The cache API reports it as 364 MB, created 2025-09-08, still being restored today — and because every run reads it, its last-accessed time keeps refreshing, so it never ages out either. Nothing in it could match: it cached all of~/.cache, whosego-buildentries are keyed by compiler build ID, so a newer toolchain misses every one. It cost time on every run and left aGOCACHEfull of dead entries thatsetup-gothen re-uploaded.setup-go's built-in cache cannot close the gap. Its key is
setup-go-{os}-{arch}-{linuxver}go-{version}-{go.sum hash}, and it callsrestoreCachewith no restore keys — a match is exact or nothing, and upstream has declined to add prefix fallback (actions/setup-go#404). So any dependency bump rebuilds everything rather than just the part that changed, and a Go point release rotates the key out from under every open PR at once.The repo is over its cache budget. It currently holds 12.24 GB against a 10 GB limit, so entries are being evicted continuously. Five
refs/pull/N/mergeentries of 585–798 MB each are setup-go saves from pull request runs, in a scope no other run can read.What this changes
actions/cachestep.cache: falseon setup-go and restores viaactions/cache/restore, keyed on thego.sumhash with a prefix fallback, so a dependency change reuses the entries that are still valid.run_idso it never matches on write. A push therefore always stores a fresh entry, rather than one pinned to thego.sumthat first created it.Narrowing the paths to
~/.cache/go-buildand~/go/pkg/moddrops~/go/bin. Binaries installed there are re-go installed on every run regardless, and the build cache covers most of that cost.Follow-up, not in this PR
The stale entries need clearing to get back under budget, including the 364 MB
livekit-protocolone this PR stops writing to.