Skip to content

ci: add support for a prepare step before using the cache - #6045

Open
remyleone wants to merge 1 commit into
mainfrom
optimize_cache
Open

ci: add support for a prepare step before using the cache#6045
remyleone wants to merge 1 commit into
mainfrom
optimize_cache

Conversation

@remyleone

@remyleone remyleone commented Aug 27, 2026

Copy link
Copy Markdown
Member

Inspiration: rclone/rclone@8b981d8

Copilot AI lite review requested due to automatic review settings August 27, 2026 10:25
@codecov-commenter

codecov-commenter commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.73%. Comparing base (306abf0) to head (c8a2b5f).
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 prepare matrix job (ubuntu/macos/windows) that downloads Go modules and populates a shared module cache.
  • Makes namespaces and others depend on prepare and restores the module cache before running tests.
  • Disables setup-go built-in caching to rely on the explicit cache steps.
Suppressed comments (2)

.github/workflows/tests.yml:44

  • Because prepare is a matrix job, needs: prepare will make each namespaces run wait for all prepare matrix runs (ubuntu/macos/windows) to finish, even though each namespaces run only needs the cache for its own OS. This can increase the workflow critical path; consider splitting namespaces into 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: prepare forces others to wait for all three OS variants of the prepare job, even though others only runs on a single runner. If the goal is to speed up CI, consider removing this dependency or restructuring so others only 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-
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.

3 participants