Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: address unreliable go dependency caching #571

Merged
merged 2 commits into from
Aug 16, 2024
Merged

Conversation

fredrikaverpil
Copy link
Member

@fredrikaverpil fredrikaverpil commented Aug 15, 2024

Why this change?

This aims to solve the problem where two caches are uploaded (one by actions/go-setup and one by actions/cache, but where the one from actions/go-setup was created by the fastest workflow (with the least
dependencies) and then often used by the slower/heavier workflows. These heavier workflows reuse the cache but it does not contain all dependencies and so it has to re-download and re-build them on every commit. The cache is not rebuilt because there are additional dependencies downloaded.

TL;DR the wrong cache is being used.

The issue is described in detail here: actions/setup-go#358

What was changed?

  • Stop using cache by actions/go-setup.
  • Extend caching of actions/cache so to also cover Go dependencies and builds. Effectively doing what actions/go-setup was supposed to handle.
  • Extend the cache key to use a hash based on all go.sum files in the project, not just .sage/go.sum.

@fredrikaverpil fredrikaverpil self-assigned this Aug 15, 2024
@fredrikaverpil fredrikaverpil force-pushed the go-caching branch 4 times, most recently from 1ea35f8 to 0e650ef Compare August 15, 2024 21:28
@fredrikaverpil fredrikaverpil marked this pull request as ready for review August 15, 2024 21:29
@fredrikaverpil fredrikaverpil requested a review from a team as a code owner August 15, 2024 21:29
@fredrikaverpil fredrikaverpil force-pushed the go-caching branch 3 times, most recently from 3910c42 to 5ecad96 Compare August 16, 2024 06:34
Due to how you cannot pass in a cache key to actions/go-setup, we cannot
reliably use the cache produced by this action. See issue for more info:
actions/setup-go#358
This invalidates the cache upon changing _any_ of the go.sum files in
the project. This is an optimization change.
@fredrikaverpil fredrikaverpil changed the title fix: do not use actions/go-setup's caching fix: address unreliable go dependency caching Aug 16, 2024
@fredrikaverpil fredrikaverpil merged commit 420961c into master Aug 16, 2024
3 checks passed
@fredrikaverpil fredrikaverpil deleted the go-caching branch August 16, 2024 09:01
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.

2 participants