aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/lint.yml
blob: 59a5d8fe615362eba7e4756f341200c15d2d4940 (plain) (blame)
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
56
57
name: Lint
on:
  workflow_call:
  workflow_dispatch:

env:
  RUST_BACKTRACE: 1
  SHELL: /bin/bash
  SCCACHE_GHA_ENABLED: "true"
  # Increment this to purge the cache (https://github.com/mozilla/sccache/blob/main/docs/GHA.md)
  SCCACHE_GHA_VERSION: 2
  RUSTC_WRAPPER: "sccache"
  CCACHE: "sccache"
  CARGO_INCREMENTAL: 0

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
        if: github.event_name != 'pull_request_target'
        with:
          fetch-depth: 2 # This is necessary for `test-tidy`.
      # This is necessary to checkout the pull request if this run was triggered via a
      # `pull_request_target` event.
      - uses: actions/checkout@v4
        if: github.event_name == 'pull_request_target'
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 2 # This is necessary for `test-tidy`.
      - name: Run sccache-cache
        uses: mozilla-actions/sccache-action@v0.0.6
      - name: Set LIBCLANG_PATH env # needed for bindgen in mozangle
        run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV
      - name: Setup Python
        uses: ./.github/actions/setup-python
      - name: Install taplo
        uses: baptiste0928/cargo-install@v3
        with:
          crate: taplo-cli
          locked: true
      - name: Install cargo-deny
        uses: baptiste0928/cargo-install@v3
        with:
          crate: cargo-deny
          locked: true
      - name: Bootstrap dependencies
        run: |
          sudo apt update
          python3 ./mach bootstrap
      # TODO: Do GitHub anotaions
      - name: Clippy
        run: |
          python3 ./mach clippy --use-crown --locked -- -- --deny warnings
      - name: Tidy
        run: python3 ./mach test-tidy --no-progress --all