File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,30 +2,34 @@ name: Rust
22
33on :
44 push :
5- branches : [ main ]
5+ branches : [main]
66 pull_request :
7- branches : [ main ]
7+ branches : [main]
88
99jobs :
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
You can’t perform that action at this time.
0 commit comments