bazel-contrib / bazel-contrib/setup-bazel
Update disk cache on cache hits
- Dominant language
- JavaScript
- Stars
- 83
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
For several years I've seen advice for caching Bazel's built artifacts in GitHub Actions by using _actions/cache_ and including _~/.cache/bazel_ as one of the captured directory paths. When doing so, with the right cache key and set of hierarchical "restore keys", we can coax Bazel into reusing a lot of what it's already built or tested and avoid it needing to run actions in subsequent workflow runs when the action inputs haven't changed.
Using this _setup-bazel_ action, I see that we can enable a _repository_ cache and a _disk_ cache, and the action takes care of [setting Bazel's output base directory](https://github.com/bazel-contrib/setup-bazel/blob/67f0a68f0e1d75250d993c073ee2130b1f7448bc/index.js#L104-L107), but it doesn't appear to save the built artifacts to a cache. My reading of [the _disk cache_ documentation](https://bazel.build/remote/caching#disk-cache) suggests that it includes "build artifacts", but even when I enable _setup-bazel_'s use of the disk cache and I see my GitHub Actions workflow run restore the disk cache successfully, it still appears that Bazel winds up running many actions for which I expected to find the outputs already available in the cache.
Do I need to use _actions/cache_ separately to cache more of these action outputs, or should the disk cache configured by _setup-bazel_ already take care of that?
Contributor guide
Research direction
Start with index.js at the linked output-base configuration around lines 104-107, then read the Bazel disk-cache documentation and the issue discussion. Determine whether the configured disk cache should contain the expected build artifacts or whether actions/cache is required; done means the caching behavior and required setup are clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, javascript
- Domain
- build-system, ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100