Skip to content

Commit d6c25dc

Browse files
committed
Add GitHub Actions CI for cargo check, fmt, and clippy
1 parent 4204a2a commit d6c25dc

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/rust-ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Rust CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
ci:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Install Rust toolchain
17+
uses: dtolnay/rust-toolchain@stable
18+
with:
19+
components: rustfmt, clippy
20+
21+
- name: Cache cargo registry
22+
uses: actions/cache@v4
23+
with:
24+
path: |
25+
~/.cargo/registry
26+
~/.cargo/git
27+
target
28+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
29+
restore-keys: ${{ runner.os }}-cargo-
30+
31+
- name: Cargo check
32+
run: cargo check --all-targets
33+
34+
- name: Cargo fmt (check)
35+
run: cargo fmt --all -- --check
36+
37+
- name: Cargo clippy
38+
run: cargo clippy --all-targets -- -D warnings

0 commit comments

Comments
 (0)