ci: use cargo-cache to maintain the registry cache small

This commit is contained in:
Victor Berger 2022-06-16 16:26:02 +02:00 committed by Victor Berger
parent c69ca56ff8
commit e943c4f246

View file

@ -58,6 +58,27 @@ jobs:
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ steps.date.outputs.date }}
restore-keys: ${{ runner.os }}-cargo-registry-
- name: Get cargo-cache latest version
id: cargocacheversion
run: echo "::set-output name=version::$(cargo search 'cargo-cache' --limit 1 | head -n 1 | cut -d ' ' -f 3 | cut -d '"' -f 2)"
- name: Cargo binaries cache
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/cargo-cache
~/.cargo/.crates.toml
~/.cargo/.crates2.json
key: ${{ runner.os }}-cargo-binaries-${{ steps.cargocacheversion.outputs.version }}
- name: Install cargo-cache
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-cache --version ${{ steps.cargocacheversion.outputs.version }}
- name: Clean cargo cache of old items
uses: actions-rs/cargo@v1
with:
command: cache
args: clean-unref
- name: Get rustc version for caching
id: rustcversion
run: echo "::set-output name=version::$(rustc --version | cut -d ' ' -f 2)"