Consolidate `~/cargo/` caches on CI
These caches have the same lifecycle and can be consolidated.
Additionally, these caches can be shared between rustc versions.
@@ -128,31 +128,13 @@ jobs:
- name: Cache cargo registry cache
uses: actions/cache@main
with:
- path: ~/.cargo/registry/cache
- key: ${{ runner.os }}-cargo-registry-cache-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
+ path: |
+ ~/.cargo/registry/cache
+ ~/.cargo/registry/index
+ ~/.cargo/git/db
+ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
- ${{ runner.os }}-cargo-registry-cache-${{ matrix.rust }}-
- ${{ runner.os }}-cargo-registry-cache-
-
- # Current size as of 2019-12-23: ~38 MB
- - name: Cache cargo registry index
- uses: actions/cache@main
- with:
- path: ~/.cargo/registry/index
- key: ${{ runner.os }}-cargo-registry-index-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
- restore-keys: |
- ${{ runner.os }}-cargo-registry-index-${{ matrix.rust }}-
- ${{ runner.os }}-cargo-registry-index-
-
- # Current size as of 2019-12-23: ~4 MB
- - name: Cache cargo git db
- uses: actions/cache@main
- with:
- path: ~/.cargo/git/db
- key: ${{ runner.os }}-cargo-git-db-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
- restore-keys: |
- ${{ runner.os }}-cargo-git-db-${{ matrix.rust }}-
- ${{ runner.os }}-cargo-git-db-
+ ${{ runner.os }}-cargo-
- name: Install ${{ matrix.rust }} Rust
run: |
