Skip to content

Commit

Permalink
Add CI caching
Browse files Browse the repository at this point in the history
  • Loading branch information
MOZGIII committed Jun 24, 2021
1 parent 2d89f53 commit 2f39cff
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/scripts/plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,24 @@ const allModes = {
name: "clippy",
cargoCommand: "clippy",
cargoArgs: "--all-targets -- -D warnings",
cargoCacheKey: "clippy",
},
test: {
name: "test",
cargoCommand: "test",
cargoCacheKey: "test",
},
build: {
name: "build",
cargoCommand: "build",
cargoCacheKey: "build",
},
fmt: {
name: "fmt",
cargoCommand: "fmt",
cargoArgs: "-- --check",
platformIndependent: true
platformIndependent: true,
cargoCacheKey: "code",
}
};

Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Cache rustup
uses: actions/cache@v2
with:
path: |
/usr/share/rust/.rustup
key: ${{ runner.os }}-rustup-${{ hashFiles('rust-toolchain.toml') }}

- name: Install rust toolchain
run: rustup show

Expand All @@ -78,6 +85,17 @@ jobs:
cargo clippy --version
env
- name: Cache cargo
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.mode.cargoCacheKey }}-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}

- name: Run cargo ${{ matrix.mode.cargoCommand }}
uses: actions-rs/cargo@v1
with:
Expand Down

0 comments on commit 2f39cff

Please sign in to comment.