Skip to content

Commit

Permalink
Merge pull request #2 from lapla-cogito/cargo-cache
Browse files Browse the repository at this point in the history
Cargo cache
  • Loading branch information
lapla-cogito authored Feb 13, 2024
2 parents 7edb1e0 + c6db1e4 commit fa04efa
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/actions/cache_cargo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: cache_cargo
description: caching .cargo directory
runs:
using: composite
steps:
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,34 @@ on:
types: [opened, synchronize, reopened]

jobs:
build-cache:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache cargo
uses: ./.github/actions/cache_cargo
- name: build
run: cargo build

cargo-fmt:
needs: build-cache
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust-toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Cache cargo
uses: ./.github/actions/cache_cargo
- name: Run rustfmt
run: cargo fmt --all -- --check

cargo-test:
needs: build-cache
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -17,6 +44,8 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo
uses: ./.github/actions/cache_cargo
- name: Run clippy
uses: giraffate/clippy-action@v1
with:
Expand Down

0 comments on commit fa04efa

Please sign in to comment.