feat(setup-go): release-cache — a release-scoped Go cache for goreleaser jobs - #56
Closed
blairham wants to merge 1 commit into
Closed
feat(setup-go): release-cache — a release-scoped Go cache for goreleaser jobs#56blairham wants to merge 1 commit into
blairham wants to merge 1 commit into
Conversation
…ser jobs setup-go's built-in cache is wrong for goreleaser jobs twice over: its key is exact-match on go.sum, so any dependency bump means a fully cold 6-target build; and the snapshot for a key is saved by whichever job first claims it — usually a CI test job, whose GOCACHE holds only host-platform test builds and warms none of the cross-compile targets. k4a's last release spent 7.6 of its 9 minutes inside goreleaser for exactly this reason. release-cache: true replaces it with a go-release-* namespaced module+build cache: restore-keys keeps dependency bumps warm, and the post step saves it after goreleaser has built every GOOS/GOARCH target, so the next release restores a build cache covering the full matrix. Default false — no change for any existing caller.
This was referenced Aug 15, 2026
Contributor
Author
|
Superseded by #58, which generalizes this: per-job cache scopes mean a goreleaser job (job id |
2 tasks
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.
Why
Release jobs rebuild the whole cross-compile matrix nearly cold every time.
actions/setup-go's built-in cache can't help them: (1) its key is exact-match ongo.sum— norestore-keys— so any dependency bump is a fully cold build; (2) a cache key's snapshot is immutable and saved by whichever job first claims it, usually a CI test job whoseGOCACHEcontains only host-platform test builds — useless for the other fiveGOOS/GOARCHtargets. k4a's last release spent 457s of its 9 minutes inside 'Run GoReleaser' for exactly this reason.What
Opt-in
release-cache: trueon thesetup-gocomposite:actions/cacheover~/go/pkg/mod+~/.cache/go-build.go-release-<os>-<hash(go.mod, go.sum)>— namespaced away from CI's cache, toolchain bumps roll it.restore-keysprefix fallback — a dependency bump restores the previous release's cache and compiles incrementally instead of cold.Default false: no behavior change for any existing caller.
Rollout
Merge this first, then flip
release-cache: truein therelease.ymlof the goreleaser repos (k4a, k5s, cloudctl, cwlogs, pp-tui) — k4a PR follows as the first caller. First release per repo populates the cache; the second one gets the speedup (expect k4a well under half its current 9min).