Skip to content

Commit

Permalink
Merge pull request #19 from unsplash/ci-cache
Browse files Browse the repository at this point in the history
Add CI caching
  • Loading branch information
samhh authored Jan 7, 2024
2 parents 908c338 + 97dc958 commit 8a6aabb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/actions/cargo-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Cargo registry and build caches
runs:
using: composite
steps:
- name: Cache registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry/
key: cargo-registry-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
cargo-registry-${{ runner.os }}
- name: Cache build
uses: actions/cache@v3
with:
path: ./target/
key: target-${{ runner.os }}-${{ github.sha }}
restore-keys: |
target-${{ runner.os }}
3 changes: 3 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- uses: actions/checkout@v3
- run: rm -rf ~/.cargo/
- uses: cachix/install-nix-action@v22
- uses: ./.github/actions/cargo-cache
- run: nix develop -c cargo check

test:
Expand All @@ -32,6 +33,7 @@ jobs:
- uses: actions/checkout@v3
- run: rm -rf ~/.cargo/
- uses: cachix/install-nix-action@v22
- uses: ./.github/actions/cargo-cache
- run: nix develop -c cargo test

lint:
Expand All @@ -41,6 +43,7 @@ jobs:
- uses: actions/checkout@v3
- run: rm -rf ~/.cargo/
- uses: cachix/install-nix-action@v22
- uses: ./.github/actions/cargo-cache
# See: https://github.com/rust-lang/rust-clippy/issues/1209
- run: RUSTFLAGS="-D warnings" nix develop -c cargo clippy --all-targets

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
- uses: actions/checkout@v3
- run: rm -rf ~/.cargo/
- uses: cachix/install-nix-action@v22
- uses: ./.github/actions/cargo-cache
- run: |
nix develop -c cargo doc --no-deps
rm ./target/doc/.lock
Expand Down

0 comments on commit 8a6aabb

Please sign in to comment.