Skip to content

Commit c233c37

Browse files
committed
ci: strengthen Rust quality gates
1 parent 80dc694 commit c233c37

1 file changed

Lines changed: 26 additions & 22 deletions

File tree

.github/workflows/rust.yml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,34 @@ name: Rust
22

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

99
jobs:
10-
build-and-test:
10+
ci:
1111
runs-on: ubuntu-latest
12-
12+
1313
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v2
16-
17-
- name: Install dependencies
18-
run: sudo apt-get update && sudo apt-get install -y curl
19-
20-
- name: Install Rust
21-
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
22-
shell: bash
23-
24-
- name: Add Rust to PATH
25-
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
26-
27-
- name: Build project
28-
run: cargo build --verbose
29-
30-
- name: Run tests
31-
run: cargo test --verbose
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Install Rust toolchain
18+
uses: dtolnay/rust-toolchain@stable
19+
with:
20+
components: rustfmt, clippy
21+
22+
- name: Cache Rust dependencies
23+
uses: Swatinem/rust-cache@v2
24+
25+
- name: Check formatting
26+
run: cargo fmt --all -- --check
27+
28+
- name: Run clippy
29+
run: cargo clippy --all-targets --all-features -- -D warnings
30+
31+
- name: Run tests
32+
run: cargo test --all-features
33+
34+
- name: Check examples
35+
run: cargo check --examples --all-features

0 commit comments

Comments
 (0)