Commit e982224
authored
ci: stop saving Go build cache outside of main (#5345)
## Why
`push.yml` saves many setup-go caches per run, but PR / merge_group /
schedule saves are scoped to refs no other run can read. They still
count against the 10 GB per-repo quota and evict main's caches via LRU,
so most PRs miss the cache entirely.
See the [GitHub Actions dependency-caching
docs](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching)
for the scope and eviction rules.
## What
### `setup-build-environment` composite
The composite now manages the Go cache explicitly instead of relying on
`setup-go`'s built-in caching. `setup-go` runs with `cache: false`. On
`refs/heads/main` (push + the scheduled wipe-and-repopulate cron from
#2092) the unified `actions/cache@v5.0.5` restores immediately and its
post-step saves at the calling job's end — composite-action post-steps
fire at the job's end, not the composite's, so this works inside the
composite. On every other ref, `actions/cache/restore@v5.0.5` restores
only. `restore-keys` provides prefix fallback so PR runs with a changed
`go.sum` still restore main's most recent cache and rebuild only the
delta. The `cache.txt` workaround is gone — `inputs.cache-key` goes
directly into the cache key string.
### Drop `task cover` from CI
`task cover` was a smoke check on main pushes. Cover-instrumented test
binaries land in a different `GOCACHE` slot than the non-cover binaries
PRs need, so a `go.sum` bump landing on a main push would leave the
cache holding cover artifacts until the next 00:00 UTC
wipe-and-repopulate fixed it (up to 24h of PRs missing the test-binary
slot). Running `task test` on every event eliminates that hole; coverage
stays in `Taskfile.yml` for local use and can come back to CI when
there's a real consumer.
### Scheduled cache wipe: twice daily → once daily
The cron from #2092 wiped the cache at 00:00 and 12:00 UTC. The noon
wipe was harmless when every PR repopulated; now that only main runs
repopulate, it creates an unnecessary cold-cache window during the
workday. Trimmed to 00:00 UTC.
## Potential follow-ups
- `check.yml` lint cache
- Three standalone `setup-go` invocations in `push.yml` (`testmask`,
`validate-generated-is-up-to-date`, `validate-python-codegen`)
- `~/.cache/golangci-lint` analyzer cache
This pull request and its description were written by Isaac.1 parent dd23604 commit e982224
2 files changed
Lines changed: 48 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 18 | + | |
| 19 | + | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
26 | | - | |
27 | | - | |
28 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
29 | 67 | | |
30 | 68 | | |
31 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 140 | + | |
145 | 141 | | |
146 | 142 | | |
147 | 143 | | |
148 | 144 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | 145 | | |
157 | 146 | | |
158 | 147 | | |
| |||
0 commit comments