Skip to content

Commit f1c570e

Browse files
committed
🔧 ci: fix GitHub Actions deprecation warnings and improve caching
- Replace deprecated Leafwing-Studios/cargo-cache with official actions/cache@v4 - Add proper cache separation for different job types (test, doc, lint) - Add GitHub token for Protoc setup to prevent rate limiting - Improve clippy commands to check all targets and features - Use hierarchical cache restore keys for better cache efficiency
1 parent 8b5fc95 commit f1c570e

File tree

1 file changed

+73
-8
lines changed

1 file changed

+73
-8
lines changed

.github/workflows/ci.yml

Lines changed: 73 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,31 @@ jobs:
1717
- uses: dtolnay/rust-toolchain@master
1818
with:
1919
toolchain: ${{ env.CARGO_TOOLCHAIN }}
20-
- name: Cache Cargo build files
21-
uses: Leafwing-Studios/cargo-cache@v1
20+
- name: Cache Cargo registry
21+
uses: actions/cache@v4
22+
with:
23+
path: ~/.cargo/registry
24+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
25+
restore-keys: |
26+
${{ runner.os }}-cargo-registry-
27+
- name: Cache Cargo index
28+
uses: actions/cache@v4
29+
with:
30+
path: ~/.cargo/git
31+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
32+
restore-keys: |
33+
${{ runner.os }}-cargo-index-
34+
- name: Cache target directory
35+
uses: actions/cache@v4
36+
with:
37+
path: target
38+
key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-target-
2241
- name: Install Protoc
2342
uses: arduino/setup-protoc@v3
43+
with:
44+
repo-token: ${{ secrets.GITHUB_TOKEN }}
2445
- name: Run cargo test
2546
run: cargo test --lib
2647

@@ -33,10 +54,32 @@ jobs:
3354
- uses: dtolnay/rust-toolchain@master
3455
with:
3556
toolchain: ${{ env.CARGO_TOOLCHAIN }}
36-
- name: Cache Cargo build files
37-
uses: Leafwing-Studios/cargo-cache@v1
57+
- name: Cache Cargo registry
58+
uses: actions/cache@v4
59+
with:
60+
path: ~/.cargo/registry
61+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
62+
restore-keys: |
63+
${{ runner.os }}-cargo-registry-
64+
- name: Cache Cargo index
65+
uses: actions/cache@v4
66+
with:
67+
path: ~/.cargo/git
68+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
69+
restore-keys: |
70+
${{ runner.os }}-cargo-index-
71+
- name: Cache target directory
72+
uses: actions/cache@v4
73+
with:
74+
path: target
75+
key: ${{ runner.os }}-target-doc-${{ hashFiles('**/Cargo.lock') }}
76+
restore-keys: |
77+
${{ runner.os }}-target-doc-
78+
${{ runner.os }}-target-
3879
- name: Install Protoc
3980
uses: arduino/setup-protoc@v3
81+
with:
82+
repo-token: ${{ secrets.GITHUB_TOKEN }}
4083
- name: Run cargo doc
4184
run: cargo doc --no-deps --document-private-items --lib
4285

@@ -50,13 +93,35 @@ jobs:
5093
with:
5194
toolchain: ${{ env.CARGO_TOOLCHAIN }}
5295
components: rustfmt, clippy
53-
- name: Cache Cargo build files
54-
uses: Leafwing-Studios/cargo-cache@v1
96+
- name: Cache Cargo registry
97+
uses: actions/cache@v4
98+
with:
99+
path: ~/.cargo/registry
100+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
101+
restore-keys: |
102+
${{ runner.os }}-cargo-registry-
103+
- name: Cache Cargo index
104+
uses: actions/cache@v4
105+
with:
106+
path: ~/.cargo/git
107+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
108+
restore-keys: |
109+
${{ runner.os }}-cargo-index-
110+
- name: Cache target directory
111+
uses: actions/cache@v4
112+
with:
113+
path: target
114+
key: ${{ runner.os }}-target-lint-${{ hashFiles('**/Cargo.lock') }}
115+
restore-keys: |
116+
${{ runner.os }}-target-lint-
117+
${{ runner.os }}-target-
55118
- name: Install Protoc
56119
uses: arduino/setup-protoc@v3
120+
with:
121+
repo-token: ${{ secrets.GITHUB_TOKEN }}
57122
- name: Check format
58123
run: cargo fmt --all -- --check
59124
- name: Run clippy with dev features
60-
run: cargo clippy
125+
run: cargo clippy --all-targets --all-features
61126
- name: Run clippy without dev features
62-
run: cargo clippy --no-default-features
127+
run: cargo clippy --all-targets --no-default-features

0 commit comments

Comments
 (0)