Skip to content

ci: add Go build and test cache to unit test jobs#4812

Open
walldiss wants to merge 2 commits intocelestiaorg:mainfrom
walldiss:ci/go-build-cache
Open

ci: add Go build and test cache to unit test jobs#4812
walldiss wants to merge 2 commits intocelestiaorg:mainfrom
walldiss:ci/go-build-cache

Conversation

@walldiss
Copy link
Member

@walldiss walldiss commented Mar 2, 2026

Summary

  • Adds actions/cache@v4 to the unit test matrix jobs (ubuntu + macOS) caching both ~/go/pkg/mod and ~/.cache/go-build
  • Disables actions/setup-go's implicit module cache to avoid double-caching the same paths
  • Cache key strategy: exact match on go.sum + all .go files; falls back to go.sum-only, then OS-only for partial hits

Why this helps

Go stores test results in ~/.cache/go-build. When the cache is restored, go test replays cached results for packages whose source and dependencies haven't changed — those packages are not retested at all. Combined with reusing compiled dependencies, this significantly reduces both compile and test time on PRs that touch a small subset of packages.

Closes https://linear.app/celestia/issue/DA-1125

Cache ~/go/pkg/mod and ~/.cache/go-build (which holds Go's built-in
test result cache) between runs. Unchanged packages are not retested.
Use layered restore keys so partial cache hits still benefit from
previously compiled dependencies.
@walldiss walldiss self-assigned this Mar 2, 2026
@walldiss walldiss added the kind:ci CI related PRs label Mar 2, 2026
@codecov-commenter
Copy link

codecov-commenter commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 35.83%. Comparing base (2469e7a) to head (9a3902e).
⚠️ Report is 671 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4812      +/-   ##
==========================================
- Coverage   44.83%   35.83%   -9.00%     
==========================================
  Files         265      311      +46     
  Lines       14620    21442    +6822     
==========================================
+ Hits         6555     7684    +1129     
- Misses       7313    12768    +5455     
- Partials      752      990     +238     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:ci CI related PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants