Use a single shared cache for all CI workflows #1506
Merged
+149
−32
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.
This is a new attempt at getting CI caching to work, based on how I set up DT's pnpm cache, https://500.keboola.com/in-depth-of-go-build-cache/, and golang/go#58571.
It works like this:
create-cache
workflow onmain
.mtime
of the files/dirs in the repo; this is important so that the build/test caches are consistent.actions/cache
, which restores a cache at the start, then saves a cache at the end, so any module we download will be saved.The
create-cache
workflow runs on pushes tomain
and on a schedule early in the morning; GitHub has a 10GB limit for the Action caches, so these jobs just keep the latest caches up to date. Since the module cache rarely changes, we need the scheduled job so that we don't accidentally drop the module cache out of the rolling window.Then, in other workflows:
mtimes
so the caches will apply.main
. These are only restored, never saved.This should have a few positive effects:
ast
or even thechecker
, so this should be pretty optimal.dprint
as I did not add that into a cache yet (another PR). It should also be faster to add a new test, since the actual code builds would have been cached.Also:
golangci-lint
cache.