Improve cache steps in github actions

This commit is contained in:
Pavan Kumar Sunkara 2020-04-20 11:09:48 +02:00
parent aae96236b2
commit 3e45cb26ab
2 changed files with 12 additions and 2 deletions

View file

@ -15,10 +15,13 @@ jobs:
uses: actions/checkout@v2
with:
ref: master
- name: Ready cache
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
- name: Cache cargo
uses: actions/cache@v1
id: cache
with:
path: /home/runner/.cargo
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Bench base
run: cargo bench -- -R bencher | tee output.txt
@ -45,8 +48,10 @@ jobs:
annotate-always: true
- name: Install cargo-cache
uses: actions-rs/install@v0.1
if: steps.cache.outputs.cache-hit != 'true'
with:
crate: cargo-cache
use-tool-cache: true
- name: Cleanup cache
if: steps.cache.outputs.cache-hit != 'true'
run: cargo cache -a

View file

@ -16,10 +16,13 @@ jobs:
toolchain: stable
- name: Checkout
uses: actions/checkout@v2
- name: Ready cache
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
- name: Cache cargo
uses: actions/cache@v1
id: cache
with:
path: /home/runner/.cargo
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Test
uses: actions-rs/cargo@v1
@ -28,8 +31,10 @@ jobs:
args: --release --features "yaml unstable"
- name: Install cargo-cache
uses: actions-rs/install@v0.1
if: steps.cache.outputs.cache-hit != 'true'
with:
crate: cargo-cache
use-tool-cache: true
- name: Cleanup cache
if: steps.cache.outputs.cache-hit != 'true'
run: cargo cache -a