about summary refs log tree commit diff
path: root/src/tools/clippy/.github/workflows/clippy_dev.yml
blob: d530eb6c73a3764ac989ae665f88b3c06220a0c8 (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
56
57
58
59
60
61
name: Clippy Dev Test

on:
  merge_group:
  pull_request:

env:
  RUST_BACKTRACE: 1
  CARGO_INCREMENTAL: 0
  RUSTFLAGS: -D warnings

jobs:
  clippy_dev:
    runs-on: ubuntu-latest

    steps:
    # Setup
    - name: Checkout
      uses: actions/checkout@v5
      with:
        # Unsetting this would make so that any malicious package could get our Github Token
        persist-credentials: false

    # Run
    - name: Build
      run: cargo build
      working-directory: clippy_dev

    - name: Test update_lints
      run: cargo dev update_lints --check

    - name: Test fmt
      run: cargo dev fmt --check

    - name: Test cargo dev new lint
      env:
        RUSTFLAGS: -A unused-imports
      run: |
        cargo dev new_lint --name new_early_pass --pass early
        cargo dev new_lint --name new_late_pass --pass late
        cargo check
        git reset --hard HEAD

  conclusion_dev:
    needs: [ clippy_dev ]
    # We need to ensure this job does *not* get skipped if its dependencies fail,
    # because a skipped job is considered a success by GitHub. So we have to
    # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
    # when the workflow is canceled manually.
    #
    # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
    if: ${{ !cancelled() }}
    runs-on: ubuntu-latest
    steps:
      # Manually check the status of all dependencies. `if: failure()` does not work.
      - name: Conclusion
        run: |
          # Print the dependent jobs to see them in the CI log
          jq -C <<< '${{ toJson(needs) }}'
          # Check if all jobs that we depend on (in the needs array) were successful.
          jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'