aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/linting.yml
blob: 9a05bf1666cd902b4e0e0f5547c3b5be1c835c5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Linting
on: [push, pull_request]

jobs:
  dependency-lint:
    name: Dependency linting
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: rm rust-toolchain.toml
      - uses: EmbarkStudios/cargo-deny-action@v1
        with:
          arguments: --all-features
          command-arguments: --allow license-not-encountered
  code-lint:
    name: Code linting
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: rm rust-toolchain.toml

      # Cache files like by target directory
      - uses: actions/cache@v3
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-rustc-${{ matrix.rust }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - uses: actions/cache@v3
        with:
          path: llvm
          key: ${{ runner.os }}-llvm-15

      # Prepare toolchain related stuff
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ matrix.rust }}
      - uses: KyleMayes/install-llvm-action@v1
        with:
          version: "15.0"

      - run: cargo clippy --all-features -- --deny warnings
  code-format:
    name: Check formatting
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: rm rust-toolchain.toml
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: nightly-2023-06-19
          components: rustfmt, rust-src
      - run: cargo fmt -- --check