Skip to content

ci: cache Go builds per job and run envtest alongside unit - #22

Merged
juancarlosm merged 1 commit into
mainfrom
ci/go-cache-parallel
Oct 29, 2026
Merged

juancarlosm merged 1 commit into
mainfrom
ci/go-cache-parallel

Conversation

@juancarlosm

Copy link
Copy Markdown
Contributor

Summary

CI takes ~13 min of wall time for a small project. Two causes, measured on run 40841359671:

  • Serial jobs: unit (2.7m) → envtest (3.8m) → e2e (6.2m). Envtest uses nothing from unit.
  • Go cache effectively off: all jobs share one cache key and only the first job to finish saves it. On PR fix(e2e): compare config digests in the kind image check #21 the Security job (compiles nothing) saved a 221-byte cache; every other job hit it and never saved. And since CI never ran on main, a new PR cannot restore anything (caches restore only from the PR ref or the base branch).

Changes

  • setup-devtools: cache key includes github.job; also caches .gocache/.cache/golangci-lint.
  • ci.yml: also runs on push: main (same paths-ignore, E2E skipped) to keep warm caches on main.
  • envtest has no needs; e2e needs unit only.

Test Plan

  • CI on this PR (cold: per-job keys are new)
  • Re-run to measure the warm-cache timing
  • After merge: the push run on main saves per-job caches

🤖 Generated with Claude Code

- setup-devtools keys the Go cache by job. With one shared key the first
  job to finish saved it; on PR #21 that was Security, which compiles
  nothing, so every job restored a 221-byte cache and never saved again.
  Also caches golangci-lint's own cache.
- CI also runs on push to main (E2E skipped) so main holds warm caches:
  a PR can only restore caches from its own ref or main.
- envtest no longer waits for unit; e2e waits for unit only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juancarlosm
juancarlosm merged commit 835a691 into main Oct 29, 2026
11 checks passed
@juancarlosm
juancarlosm deleted the ci/go-cache-parallel branch October 29, 2026 09:16
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