ci: add support for a prepare step before using the cache - #6045
Open
remyleone wants to merge 1 commit into
Open
ci: add support for a prepare step before using the cache#6045remyleone wants to merge 1 commit into
remyleone wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6045 +/- ##
=======================================
Coverage 50.73% 50.73%
=======================================
Files 359 359
Lines 82139 82139
=======================================
Hits 41674 41674
Misses 40465 40465 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the CI test workflow to introduce a dedicated “prepare” job that pre-populates the Go module cache before running the main test jobs, aiming to reduce repeated dependency downloads across the matrix.
Changes:
- Adds a new
preparematrix job (ubuntu/macos/windows) that downloads Go modules and populates a shared module cache. - Makes
namespacesandothersdepend onprepareand restores the module cache before running tests. - Disables
setup-gobuilt-in caching to rely on the explicit cache steps.
Suppressed comments (2)
.github/workflows/tests.yml:44
- Because
prepareis a matrix job,needs: preparewill make eachnamespacesrun wait for allpreparematrix runs (ubuntu/macos/windows) to finish, even though eachnamespacesrun only needs the cache for its own OS. This can increase the workflow critical path; consider splittingnamespacesinto per-OS jobs (each needing its corresponding prepare job) or avoiding the cross-job dependency by doing cache restore/update within the same job.
needs: prepare
.github/workflows/tests.yml:121
- Same matrix-wide dependency concern here:
needs: prepareforcesothersto wait for all three OS variants of thepreparejob, even thoughothersonly runs on a single runner. If the goal is to speed up CI, consider removing this dependency or restructuring soothersonly waits on the relevant prepare job.
needs: prepare
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| merge_group: | ||
|
|
||
| jobs: | ||
| prepare: |
Comment on lines
+34
to
+42
| - name: Download modules | ||
| run: go mod download | ||
| - name: Save module cache | ||
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | ||
| with: | ||
| path: ${{ steps.gomodcache.outputs.path }} | ||
| key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gomod- |
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.
Inspiration: rclone/rclone@8b981d8