|
1 | 1 | name: CI |
2 | 2 |
|
3 | | -on: [push, pull_request] |
| 3 | +on: [ push, pull_request, workflow_dispatch ] |
4 | 4 |
|
5 | 5 | permissions: |
6 | 6 | contents: read |
|
9 | 9 | build: |
10 | 10 | name: Build and Test on ${{ matrix.os }} |
11 | 11 | runs-on: ${{ matrix.os }} |
12 | | - |
| 12 | + |
13 | 13 | strategy: |
14 | 14 | matrix: |
15 | 15 | os: [ubuntu-latest, windows-latest, macos-latest] |
16 | | - |
| 16 | + |
17 | 17 | steps: |
18 | 18 | - name: Checkout repository |
19 | | - uses: actions/checkout@v3 |
20 | | - |
21 | | - - name: Install Rust |
22 | | - uses: actions-rs/toolchain@v1 |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Install Rust (stable) |
| 22 | + uses: dtolnay/rust-toolchain@stable |
23 | 23 | with: |
24 | | - toolchain: stable |
25 | | - override: true |
26 | 24 | components: clippy, rustfmt |
27 | | - |
| 25 | + |
28 | 26 | - name: Cache cargo registry |
29 | 27 | uses: actions/cache@v3 |
30 | 28 | with: |
31 | 29 | path: ~/.cargo/registry |
32 | 30 | key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
33 | | - |
| 31 | + |
34 | 32 | - name: Cache cargo git |
35 | 33 | uses: actions/cache@v3 |
36 | 34 | with: |
37 | 35 | path: ~/.cargo/git |
38 | 36 | key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} |
39 | | - |
| 37 | + |
40 | 38 | - name: Cache target directory |
41 | 39 | uses: actions/cache@v3 |
42 | 40 | with: |
43 | 41 | path: target |
44 | 42 | key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }} |
45 | | - |
| 43 | + |
46 | 44 | - name: Build in release mode |
47 | 45 | run: cargo build --release |
48 | | - |
| 46 | + |
49 | 47 | - name: Run tests |
50 | 48 | run: cargo test --all |
51 | | - |
| 49 | + |
52 | 50 | - name: Run Clippy (no warnings allowed) |
53 | | - run: cargo clippy -- -D warnings |
54 | | - |
| 51 | + run: cargo clippy --all-targets --all-features -- -D warnings |
| 52 | + |
55 | 53 | - name: Check code formatting |
56 | | - run: cargo fmt -- --check |
57 | | - |
| 54 | + run: cargo fmt --all -- --check |
| 55 | + |
58 | 56 | - name: Install cargo-audit |
59 | 57 | run: cargo install cargo-audit |
60 | | - |
| 58 | + |
61 | 59 | - name: Run cargo audit |
62 | 60 | run: cargo audit |
0 commit comments