|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_TERM_COLOR: always |
| 11 | + RUST_BACKTRACE: 1 |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint: |
| 15 | + name: Lint |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v6 |
| 19 | + |
| 20 | + - name: Install Rust (MSRV) |
| 21 | + uses: dtolnay/rust-toolchain@1.85 |
| 22 | + with: |
| 23 | + components: rustfmt, clippy |
| 24 | + |
| 25 | + - name: Cache cargo |
| 26 | + uses: actions/cache@v5 |
| 27 | + with: |
| 28 | + path: | |
| 29 | + ~/.cargo/registry/index/ |
| 30 | + ~/.cargo/registry/cache/ |
| 31 | + ~/.cargo/git/db/ |
| 32 | + target/ |
| 33 | + key: ${{ runner.os }}-lint-${{ hashFiles('**/Cargo.toml') }} |
| 34 | + restore-keys: ${{ runner.os }}-lint- |
| 35 | + |
| 36 | + - name: Check formatting |
| 37 | + run: cargo fmt --check |
| 38 | + |
| 39 | + - name: Clippy |
| 40 | + run: cargo clippy --all-targets -- -D warnings |
| 41 | + |
| 42 | + test: |
| 43 | + name: Test (${{ matrix.os }}) |
| 44 | + runs-on: ${{ matrix.os }} |
| 45 | + strategy: |
| 46 | + fail-fast: true |
| 47 | + matrix: |
| 48 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v6 |
| 51 | + |
| 52 | + - name: Install Rust (stable) |
| 53 | + uses: dtolnay/rust-toolchain@stable |
| 54 | + |
| 55 | + - name: Cache cargo |
| 56 | + uses: actions/cache@v5 |
| 57 | + with: |
| 58 | + path: | |
| 59 | + ~/.cargo/registry/index/ |
| 60 | + ~/.cargo/registry/cache/ |
| 61 | + ~/.cargo/git/db/ |
| 62 | + target/ |
| 63 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} |
| 64 | + restore-keys: ${{ runner.os }}-cargo- |
| 65 | + |
| 66 | + - name: Test |
| 67 | + run: cargo test |
| 68 | + |
| 69 | + - name: Check no-default-features |
| 70 | + run: cargo check --no-default-features |
| 71 | + |
| 72 | + deny: |
| 73 | + name: cargo-deny (licences + advisories) |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v6 |
| 77 | + - uses: EmbarkStudios/cargo-deny-action@v2 |
| 78 | + with: |
| 79 | + command: check |
| 80 | + |
| 81 | + msrv: |
| 82 | + name: MSRV check (Rust 1.85) |
| 83 | + runs-on: ubuntu-latest |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v6 |
| 86 | + - uses: dtolnay/rust-toolchain@1.85 |
| 87 | + - name: Cache cargo |
| 88 | + uses: actions/cache@v5 |
| 89 | + with: |
| 90 | + path: | |
| 91 | + ~/.cargo/registry/index/ |
| 92 | + ~/.cargo/registry/cache/ |
| 93 | + ~/.cargo/git/db/ |
| 94 | + target/ |
| 95 | + key: ${{ runner.os }}-msrv-${{ hashFiles('**/Cargo.toml') }} |
| 96 | + restore-keys: ${{ runner.os }}-msrv- |
| 97 | + - name: Check MSRV |
| 98 | + run: cargo check --all-features |
0 commit comments