Skip to content

Commit e42fdf2

Browse files
committed
fix ci caching
1 parent a44646e commit e42fdf2

File tree

1 file changed

+48
-47
lines changed

1 file changed

+48
-47
lines changed

.github/workflows/ci.yaml

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Rust CI
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [ main ]
66
pull_request:
7-
branches: [main]
7+
branches: [ main ]
88

99
env:
1010
CARGO_TERM_COLOR: always
@@ -15,29 +15,33 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
rust_version: [stable, beta, nightly, 1.73.0, "stable minus 1 release", "stable minus 2 releases"]
18+
rust_version: [ stable, beta, nightly, 1.73.0, "stable minus 1 release", "stable minus 2 releases" ]
1919
steps:
2020
- uses: actions/checkout@v4
2121
- uses: dtolnay/rust-toolchain@master
2222
with:
2323
toolchain: ${{ matrix.rust_version }}
24-
- name: Cache cargo registry
25-
uses: actions/cache@v3
26-
with:
27-
path: ~/.cargo/registry
28-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }}
29-
- name: Cache cargo index
30-
uses: actions/cache@v3
24+
- name: Cache cargo
25+
uses: actions/cache@v4
3126
with:
32-
path: ~/.cargo/git
33-
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }}
27+
path: ~/.cargo/
28+
key: ${{ runner.os }}-cargo-registry-${{ matrix.rust_version }}-${{ hashFiles('**/Cargo.lock') }}
29+
restore-keys: |
30+
${{ runner.os }}-cargo-registry-${{ matrix.rust_version }}-
3431
- name: Cache cargo build
3532
uses: actions/cache@v3
3633
with:
37-
path: target
38-
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }}
34+
path: ~/work/gosub-engine/gosub-engine/target
35+
key: ${{ runner.os }}-cargo-target-${{ matrix.rust_version }}-${{ hashFiles('**/Cargo.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-cargo-target-${{ matrix.rust_version }}-
3938
- name: Build
4039
run: cargo build --verbose --all --all-features
40+
- name: Clean
41+
run: |
42+
cargo install cargo-sweep
43+
cargo sweep --installed
44+
cargo sweep --time 7
4145
4246
test:
4347
runs-on: ubuntu-latest
@@ -52,21 +56,20 @@ jobs:
5256
- uses: dtolnay/rust-toolchain@master
5357
with:
5458
toolchain: ${{ matrix.rust_version }}
55-
- name: Cache cargo registry
56-
uses: actions/cache@v3
57-
with:
58-
path: ~/.cargo/registry
59-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }}
60-
- name: Cache cargo index
61-
uses: actions/cache@v3
59+
- name: Cache cargo
60+
uses: actions/cache@v4
6261
with:
63-
path: ~/.cargo/git
64-
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }}
62+
path: ~/.cargo
63+
key: ${{ runner.os }}-cargo-registry-${{ matrix.rust_version }}-${{ hashFiles('**/Cargo.lock') }}
64+
restore-keys: |
65+
${{ runner.os }}-cargo-registry-${{ matrix.rust_version }}-
6566
- name: Cache cargo build
6667
uses: actions/cache@v3
6768
with:
68-
path: target
69-
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }}
69+
path: ~/work/gosub-engine/gosub-engine/target
70+
key: ${{ runner.os }}-cargo-target-${{ matrix.rust_version }}-${{ hashFiles('**/Cargo.lock') }}
71+
restore-keys: |
72+
${{ runner.os }}-cargo-target-${{ matrix.rust_version }}-
7073
- name: Run tests
7174
run: cargo test --verbose --all --no-fail-fast --all-features --all-targets
7275

@@ -81,21 +84,20 @@ jobs:
8184
- uses: dtolnay/rust-toolchain@master
8285
with:
8386
toolchain: ${{ matrix.rust_version }}
84-
- name: Cache cargo registry
85-
uses: actions/cache@v3
86-
with:
87-
path: ~/.cargo/registry
88-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }}
89-
- name: Cache cargo index
90-
uses: actions/cache@v3
87+
- name: Cache cargo
88+
uses: actions/cache@v4
9189
with:
92-
path: ~/.cargo/git
93-
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }}
90+
path: ~/.cargo
91+
key: ${{ runner.os }}-cargo-registry-${{ matrix.rust_version }}-${{ hashFiles('**/Cargo.lock') }}
92+
restore-keys: |
93+
${{ runner.os }}-cargo-registry-${{ matrix.rust_version }}-
9494
- name: Cache cargo build
9595
uses: actions/cache@v3
9696
with:
97-
path: target
98-
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust_version }}
97+
path: ~/work/gosub-engine/gosub-engine/target
98+
key: ${{ runner.os }}-cargo-target-${{ matrix.rust_version }}-${{ hashFiles('**/Cargo.lock') }}
99+
restore-keys: |
100+
${{ runner.os }}-cargo-target-${{ matrix.rust_version }}-
99101
- name: Run Clippy
100102
run: cargo clippy --all --tests -- -D warnings
101103

@@ -104,20 +106,19 @@ jobs:
104106
steps:
105107
- uses: actions/checkout@v4
106108
- uses: dtolnay/rust-toolchain@stable
107-
- name: Cache cargo registry
108-
uses: actions/cache@v3
109-
with:
110-
path: ~/.cargo/registry
111-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-stable
112-
- name: Cache cargo index
113-
uses: actions/cache@v3
109+
- name: Cache cargo
110+
uses: actions/cache@v4
114111
with:
115-
path: ~/.cargo/git
116-
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}-stable
112+
path: ~/.cargo
113+
key: ${{ runner.os }}-cargo-registry-${{ matrix.rust_version }}-${{ hashFiles('**/Cargo.lock') }}
114+
restore-keys: |
115+
${{ runner.os }}-cargo-registry-${{ matrix.rust_version }}-
117116
- name: Cache cargo build
118117
uses: actions/cache@v3
119118
with:
120-
path: target
121-
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-stable
119+
path: ~/work/gosub-engine/gosub-engine/target
120+
key: ${{ runner.os }}-cargo-target-${{ matrix.rust_version }}-${{ hashFiles('**/Cargo.lock') }}
121+
restore-keys: |
122+
${{ runner.os }}-cargo-target-${{ matrix.rust_version }}-
122123
- name: Run fmt
123124
run: cargo fmt --check --all

0 commit comments

Comments
 (0)