mirror of
https://github.com/actions/cache.git
synced 2024-11-22 01:41:26 +01:00
Improve cargo example
Adds `restore-keys` for cargo - this helps improve build times by allowing the cache to be mostly pre-populated when deps are updated. Adds two missing cache files. Adds a build type parameter to the cache keys to account for different build profiles / targets.
This commit is contained in:
parent
704facf57e
commit
226a795b51
1 changed files with 7 additions and 1 deletions
|
@ -589,14 +589,20 @@ whenever possible:
|
|||
|
||||
```yaml
|
||||
- uses: actions/cache@v3
|
||||
env:
|
||||
BUILD_TYPE: debug # adjust when using `--release` or custom targets
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/.crates.toml
|
||||
~/.cargo/.crates2.json
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
key: ${{ runner.os }}-cargo-${{ env.BUILD_TYPE }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-${{ env.BUILD_TYPE }}-
|
||||
```
|
||||
|
||||
## Scala - SBT
|
||||
|
|
Loading…
Reference in a new issue