Repository navigation
ci: restore the race test cache by prefix and save it only from main - #2437
Merged
Merged
Conversation
rdimitrov
force-pushed
the
ci/race-test-cache
branch
from
October 20, 2026 11:40
46b990b to
a905464
Compare
The Test (race) job took 5-7 minutes when setup-go restored its Go build and test cache, and 16-23 minutes when it did not. setup-go keys that cache on a hash of every go.sum with no fallback, so any dependency bump or evicted entry made the next run fully cold. Every PR run also saved its own ~1.8 GB entry, which pushed the repository past its cache quota and evicted the main entry that other PRs could have shared. Restore the newest main entry by key prefix instead, and save a fresh entry only after a green push to main. Go's caches are content-addressed, so an entry from a nearby commit is still almost entirely valid. Co-Authored-By: Claude Opus 5.5 <[email protected]>
rdimitrov
force-pushed
the
ci/race-test-cache
branch
from
October 20, 2026 11:41
a905464 to
d4775a1
Compare
Merged
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 Test (race) takes 17-23 min on most runs
It comes down to a cache hit versus a cache miss, not slow packages or runner variance.
On a hit, 145 of 193 packages reuse cached
-racetest results and compiles are warm. On a miss, every package is recompiled with-raceand retested on 4 vCPUs.Two reasons for the misses:
go.sumand has norestore-keys. Any Renovate bump anywhere in the module set produces a new key and a fully cold run, until a main run saves one.Slowest packages on a cold run (job 118586642248, under 4-way contention):
cmd/mecatui/uiruns 360-560 s even when warm, so the job can't drop much below about 6 min without sharding. That isn't needed to reach the ~9 min target, so this PR leaves it alone.Change
In the Test (race) job only:
setup-gowithcache: false.actions/cache/restorekeyedgo-race-<os>-<arch>-go<version>-<sha>, withrestore-keyson the prefix, so a run always gets the newest entry. Go's build and test caches are content-addressed, so an entry from a nearby commit is still almost entirely valid.actions/cache/saveonly after a green push tomain. PR runs no longer write entries, which also means fork PRs can't seed cache entries. Every PR restore marks the main entry as recently used, so LRU eviction keeps it.The
Test (race)check name and every other job are unchanged.Before / after
Measured on this PR, with a temporary commit that let it seed its own entry (since dropped). A stacked PR reads its base branch's cache scope, not main's.
The warm job includes a 20 s save step that PR runs won't have once the TEMP commit is gone, so a PR job should take about 7.7 min.
Caveat: the cache is saved only from main, so PRs opened right after this merges stay cold (~17 min) until a push to main has saved the first
go-race-entry. That main run is itself cold. Every later main push refreshes the entry.Verification
actionlint(pinned v1.7.7),lint:action-templates,test:docs-only-classifier, deslop and noindex workflow tests: pass.task lintfails locally only on a gosec finding inenvironment/microvm/launch_ownership_darwin.go. That file is darwin-only, outside this diff, and not linted on CI's Linux runner.🤖 Generated with Claude Code