|
1 | 1 | name: build
|
2 | 2 |
|
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + |
3 | 6 | on: [push, pull_request]
|
4 | 7 |
|
| 8 | +env: |
| 9 | + RUST_BACKTRACE: 1 |
| 10 | + CARGO_TERM_COLOR: always |
| 11 | + CLICOLOR: 1 |
| 12 | + |
5 | 13 | jobs:
|
6 | 14 | build:
|
7 |
| - runs-on: ${{ matrix.os }} |
| 15 | + permissions: |
| 16 | + contents: none |
| 17 | + name: CI |
| 18 | + needs: [test, msrv, lockfile, docs, rustfmt, clippy, minimal-versions] |
| 19 | + runs-on: ubuntu-latest |
| 20 | + if: "always()" |
| 21 | + steps: |
| 22 | + - name: Failed |
| 23 | + run: exit 1 |
| 24 | + if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')" |
| 25 | + test: |
| 26 | + name: Test |
8 | 27 | strategy:
|
9 |
| - fail-fast: false |
10 | 28 | matrix:
|
11 |
| - os: [ubuntu-latest, windows-latest, macos-latest] |
12 |
| - toolchain: [stable] |
| 29 | + os: ["ubuntu-latest", "windows-latest", "macos-latest"] |
| 30 | + rust: ["stable"] |
| 31 | + continue-on-error: ${{ matrix.rust != 'stable' }} |
| 32 | + runs-on: ${{ matrix.os }} |
13 | 33 | steps:
|
14 |
| - - name: Install latest nightly |
15 |
| - uses: actions-rs/toolchain@v1 |
| 34 | + - name: Checkout repository |
| 35 | + uses: actions/checkout@v4 |
| 36 | + - name: Install Rust |
| 37 | + uses: dtolnay/rust-toolchain@stable |
16 | 38 | with:
|
17 |
| - toolchain: ${{ matrix.toolchain }} |
18 |
| - override: true |
19 |
| - - uses: actions/checkout@v2 |
20 |
| - - uses: Swatinem/rust-cache@v1 |
| 39 | + toolchain: ${{ matrix.rust }} |
| 40 | + - uses: Swatinem/rust-cache@v2 |
21 | 41 | - name: Build
|
22 |
| - run: cargo build --verbose |
23 |
| - continue-on-error: ${{ matrix.toolchain != 'stable' }} |
24 |
| - - name: Run tests |
25 |
| - run: cargo test --verbose |
26 |
| - continue-on-error: ${{ matrix.toolchain != 'stable' }} |
27 |
| - |
28 |
| - clippy: |
29 |
| - name: clippy (ubuntu-latest, stable) |
| 42 | + run: cargo test --no-run |
| 43 | + - name: Test |
| 44 | + run: cargo test |
| 45 | + lockfile: |
30 | 46 | runs-on: ubuntu-latest
|
31 | 47 | steps:
|
32 |
| - - name: Install latest stable |
33 |
| - uses: actions-rs/toolchain@v1 |
34 |
| - with: |
35 |
| - toolchain: stable |
36 |
| - override: true |
37 |
| - components: clippy |
38 |
| - - name: Checkout sources |
39 |
| - uses: actions/checkout@v2 |
40 |
| - - uses: Swatinem/rust-cache@v1 |
41 |
| - - name: Cargo Clippy |
42 |
| - run: cargo clippy -- -D warnings -A deprecated |
43 |
| - |
44 |
| - fmt: |
45 |
| - name: fmt (ubuntu-latest, stable) |
| 48 | + - name: Checkout repository |
| 49 | + uses: actions/checkout@v4 |
| 50 | + - name: Install Rust |
| 51 | + uses: dtolnay/rust-toolchain@stable |
| 52 | + with: |
| 53 | + toolchain: stable |
| 54 | + - uses: Swatinem/rust-cache@v2 |
| 55 | + - name: "Is lockfile updated?" |
| 56 | + run: cargo update --workspace --locked |
| 57 | + rustfmt: |
| 58 | + name: rustfmt |
| 59 | + runs-on: ubuntu-latest |
| 60 | + steps: |
| 61 | + - name: Checkout repository |
| 62 | + uses: actions/checkout@v4 |
| 63 | + - name: Install Rust |
| 64 | + uses: dtolnay/rust-toolchain@stable |
| 65 | + with: |
| 66 | + toolchain: stable |
| 67 | + components: rustfmt |
| 68 | + - uses: Swatinem/rust-cache@v2 |
| 69 | + - name: Check formatting |
| 70 | + run: cargo fmt --all -- --check |
| 71 | + clippy: |
| 72 | + name: clippy |
46 | 73 | runs-on: ubuntu-latest
|
| 74 | + permissions: |
| 75 | + security-events: write # to upload sarif results |
47 | 76 | steps:
|
48 |
| - - name: Install latest stable |
49 |
| - uses: actions-rs/toolchain@v1 |
50 |
| - with: |
51 |
| - toolchain: stable |
52 |
| - override: true |
53 |
| - components: rustfmt |
54 |
| - - name: Checkout sources |
55 |
| - uses: actions/checkout@v2 |
56 |
| - - name: Check Formatting |
57 |
| - run: cargo fmt --all -- --check |
| 77 | + - name: Checkout repository |
| 78 | + uses: actions/checkout@v4 |
| 79 | + - name: Install Rust |
| 80 | + uses: dtolnay/rust-toolchain@stable |
| 81 | + with: |
| 82 | + toolchain: stable |
| 83 | + components: clippy |
| 84 | + - uses: Swatinem/rust-cache@v2 |
| 85 | + - name: Install SARIF tools |
| 86 | + run: cargo install clippy-sarif --locked |
| 87 | + - name: Install SARIF tools |
| 88 | + run: cargo install sarif-fmt --locked |
| 89 | + - name: Check |
| 90 | + run: > |
| 91 | + cargo clippy --workspace --all-features --all-targets --message-format=json |
| 92 | + | clippy-sarif |
| 93 | + | tee clippy-results.sarif |
| 94 | + | sarif-fmt |
| 95 | + continue-on-error: true |
| 96 | + - name: Upload |
| 97 | + uses: github/codeql-action/upload-sarif@v3 |
| 98 | + with: |
| 99 | + sarif_file: clippy-results.sarif |
| 100 | + wait-for-processing: true |
| 101 | + - name: Report status |
| 102 | + run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated |
0 commit comments