github: improve caching mechanism

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-07-24 02:50:38 +05:30
parent 03a216e977
commit 9ab249da46
No known key found for this signature in database
GPG Key ID: 366D7BBAD1031E80
2 changed files with 26 additions and 17 deletions

View File

@ -9,15 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
uses: actions/checkout@v2
- name: Install Rust nightly with rustfmt and clippy
uses: actions-rs/toolchain@v1
@ -38,6 +30,19 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate lockfile
uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- name: Cache cargo registry and build outputs
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Check formatting
uses: actions-rs/cargo@v1
with:

View File

@ -9,14 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
uses: actions/checkout@v2
- name: Install Nix
uses: cachix/install-nix-action@v10
@ -26,5 +19,16 @@ jobs:
- name: Enter nix-shell
run: nix-shell --pure
- name: Generate lockfile
run: cargo generate-lockfile
- name: Cache cargo registry and build outputs
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Run cargo check
run: cargo check