mirror of
https://github.com/moonrepo/setup-rust.git
synced 2025-04-29 13:30:03 +00:00
Polish.
This commit is contained in:
parent
d7d917b850
commit
8a603fb6f3
4 changed files with 23 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
# 1.1.0
|
||||
|
||||
- Added a `cache-base` input. When provided, will only save cache on this branch/ref, but will
|
||||
restore cache on all branches/refs.
|
||||
- Updated dependencies.
|
||||
|
||||
# 1.0.3
|
||||
|
|
19
README.md
19
README.md
|
@ -22,6 +22,8 @@ optional.
|
|||
|
||||
- `bins` - Comma-separated list of global binaries to install into Cargo.
|
||||
- `cache` - Toggle caching of directories. Defaults to `true`.
|
||||
- `cache-base` - Base branch/ref to save a warmup cache on. Other branches/refs will restore from
|
||||
this base.
|
||||
- `cache-target` - Name of the target profile to cache. Defaults to `debug`.
|
||||
- `channel` - Toolchain specification/channel to explicitly install.
|
||||
- `components` - Comma-separated list of additional components to install.
|
||||
|
@ -135,6 +137,23 @@ The following optimizations and considerations are taken into account when cachi
|
|||
> The following sources are hashed for the generated cache key: `$GITHUB_JOB`, `Cargo.lock`, Rust
|
||||
> version, Rust commit hash, and OS.
|
||||
|
||||
### Warmup strategy
|
||||
|
||||
Another strategy that we support is called a warmup cache, where a base branch/ref is used to
|
||||
generate and save the cache (like master), and all other branches/refs will _only_ restore this
|
||||
cache (and not save).
|
||||
|
||||
This can be enabled with the `cache-base` input, which requires a branch/ref name. This input also
|
||||
supports regex.
|
||||
|
||||
```yaml
|
||||
- uses: moonrepo/setup-rust@v1
|
||||
with:
|
||||
cache-base: master
|
||||
# With regex
|
||||
cache-base: (master|main|develop)
|
||||
```
|
||||
|
||||
## Compared to
|
||||
|
||||
### `actions-rs/*`
|
||||
|
|
|
@ -11,8 +11,7 @@ inputs:
|
|||
default: true
|
||||
cache-base:
|
||||
description:
|
||||
'Base branch or ref to save a warmup cache. Other branches and refs will restore from this
|
||||
base.'
|
||||
'Base branch/ref to save a warmup cache on. Other branches/refs will restore from this base.'
|
||||
cache-target:
|
||||
description: 'Name of the target profile to cache.'
|
||||
default: 'debug'
|
||||
|
|
|
@ -49,6 +49,7 @@ export async function getPrimaryCacheKey() {
|
|||
|
||||
if (core.getInput('cache-base')) {
|
||||
core.debug('Using warmup strategy, not hashing Cargo.lock, GITHUB_WORKFLOW, or GITHUB_JOB');
|
||||
hasher.update('warmup');
|
||||
}
|
||||
|
||||
// When warming up, these add far too much granularity to the cache key
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue