Fix cache bug with Bazel builds in CI #1593
Merged
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.
Some time ago, bazel builds in CI were being sped up fine with caching. However, over time the cache got stale because
actions/cache@v3
apparently doesn't update caches when it "hits" unless it is configured to do so specifically. This requires using a uniqued per-commitkey
(to force it to update cache after each successful run) and a relaxedrestore-keys
which is not unique per-commit so newer commits can restore from the nearest hit.Test GHA run 1 (no cache hit): 1h 1m 52s
Test GHA run 2 (cache hit, same commit): 5m 14s
Test GHA run 3 (cache hit, different commit): 6m 6s