|
| 1 | +name: Lint |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +env: |
| 5 | + CARGO_TERM_COLOR: always |
| 6 | + |
| 7 | +jobs: |
| 8 | + fmt: |
| 9 | + name: Rustfmt |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v5 |
| 13 | + - uses: dtolnay/rust-toolchain@stable |
| 14 | + with: |
| 15 | + components: rustfmt |
| 16 | + - name: Enforce formatting |
| 17 | + run: cargo fmt -- --check |
| 18 | + |
| 19 | + cargo_check: |
| 20 | + name: Cargo Check |
| 21 | + runs-on: ${{ matrix.os }} |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + os: [ubuntu-latest, windows-latest] |
| 25 | + rust: [stable, beta, nightly] |
| 26 | + feature: ["", "--all-features", "--no-default-features"] |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v5 |
| 29 | + - uses: dtolnay/rust-toolchain@master |
| 30 | + with: |
| 31 | + toolchain: ${{ matrix.rust }} |
| 32 | + - name: Cache |
| 33 | + uses: actions/cache@v3 |
| 34 | + with: |
| 35 | + path: | |
| 36 | + ~/.cargo/bin/ |
| 37 | + ~/.cargo/registry/index/ |
| 38 | + ~/.cargo/registry/cache/ |
| 39 | + ~/.cargo/git/db/ |
| 40 | + target/ |
| 41 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 42 | + - name: Rust cargo check |
| 43 | + run: cargo check --workspace ${{ matrix.feature }} |
| 44 | + |
| 45 | + clippy: |
| 46 | + name: Clippy |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v5 |
| 50 | + - uses: dtolnay/rust-toolchain@stable |
| 51 | + with: |
| 52 | + components: clippy |
| 53 | + - name: Cache |
| 54 | + uses: actions/cache@v3 |
| 55 | + with: |
| 56 | + path: | |
| 57 | + ~/.cargo/bin/ |
| 58 | + ~/.cargo/registry/index/ |
| 59 | + ~/.cargo/registry/cache/ |
| 60 | + ~/.cargo/git/db/ |
| 61 | + target/ |
| 62 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 63 | + - uses: actions-rs/clippy-check@v1 |
| 64 | + with: |
| 65 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + args: --all-features --tests -- -F clippy::pedantic |
| 67 | + |
| 68 | + audit: |
| 69 | + name: Security Audit |
| 70 | + runs-on: ubuntu-latest |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v5 |
| 73 | + - uses: dtolnay/rust-toolchain@stable |
| 74 | + - name: Cache |
| 75 | + uses: actions/cache@v3 |
| 76 | + with: |
| 77 | + path: | |
| 78 | + ~/.cargo/bin/ |
| 79 | + ~/.cargo/registry/index/ |
| 80 | + ~/.cargo/registry/cache/ |
| 81 | + ~/.cargo/git/db/ |
| 82 | + target/ |
| 83 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 84 | + - name: Run audit |
| 85 | + uses: actions-rs/audit-check@v1 |
| 86 | + with: |
| 87 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments