Skip to content

Commit 1fcd273

Browse files
committed
ci: optimize workflow with caching, linting, and modern actions
- Replace deprecated actions-rs/toolchain with dtolnay/rust-toolchain - Add Cargo registry and target directory caching - Include rustfmt formatting checks and clippy linting - Rename job from 'build' to 'test' with descriptive name
1 parent a6ee854 commit 1fcd273

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,38 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
build:
14-
13+
test:
14+
name: Test Suite
1515
runs-on: ubuntu-latest
1616

1717
steps:
1818
- uses: actions/checkout@v4
19+
1920
- name: Install Rust Toolchain
20-
uses: actions-rs/toolchain@v1 # Or actions-rust-lang/setup-rust-toolchain@v1
21+
uses: dtolnay/rust-toolchain@stable
22+
with:
23+
toolchain: stable
24+
components: rustfmt, clippy
25+
26+
- name: Cache Cargo registry
27+
uses: actions/cache@v4
2128
with:
22-
toolchain: stable # Use 'stable' to get the latest stable Rust
23-
profile: minimal
24-
override: true
29+
path: |
30+
~/.cargo/registry
31+
~/.cargo/git
32+
target
33+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-cargo-
36+
37+
- name: Check formatting
38+
run: cargo fmt -- --check
39+
40+
- name: Run Clippy
41+
run: cargo clippy --all-targets --all-features -- -D warnings
2542

2643
- name: Build
2744
run: cargo build --verbose
45+
2846
- name: Run tests
2947
run: cargo test --verbose

0 commit comments

Comments
 (0)