|
| 1 | +name: New lint stabilization version check |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - auto |
| 7 | + - try |
| 8 | + pull_request: |
| 9 | + paths: |
| 10 | + - 'clippy_lints/src/**/*.rs' |
| 11 | + |
| 12 | +env: |
| 13 | + RUST_BACKTRACE: 1 |
| 14 | + CARGO_INCREMENTAL: 0 |
| 15 | + |
| 16 | +concurrency: |
| 17 | + # For a given workflow, if we push to the same PR, cancel all previous builds on that PR. |
| 18 | + group: "${{ github.workflow }}-${{ github.event.pull_request.number}}" |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +jobs: |
| 22 | + # Collect lint metadata on the PR's target branch and stores the results as an artifact |
| 23 | + base: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + fetch-depth: 2 |
| 31 | + |
| 32 | + # HEAD is the generated merge commit `refs/pull/N/merge` between the PR and `master`, `HEAD^` |
| 33 | + # being the commit from `master` that is the base of the merge |
| 34 | + - name: Checkout base |
| 35 | + run: git checkout HEAD^ |
| 36 | + |
| 37 | + - name: Cache metadata |
| 38 | + id: cache-metadata |
| 39 | + uses: actions/cache@v4 |
| 40 | + with: |
| 41 | + path: util/gh-pages/lints.json |
| 42 | + key: metadata-bin-${{ hashfiles('clippy_lints/**') }} |
| 43 | + |
| 44 | + - name: Collect metadata |
| 45 | + if: steps.cache-metadata.outputs.cache-hit != 'true' |
| 46 | + run: cargo collect-metadata |
| 47 | + |
| 48 | + - name: Upload base JSON |
| 49 | + uses: actions/upload-artifact@v4 |
| 50 | + with: |
| 51 | + name: base |
| 52 | + path: util/gh-pages/lints.json |
| 53 | + |
| 54 | + head: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + |
| 57 | + steps: |
| 58 | + - name: Checkout |
| 59 | + uses: actions/checkout@v4 |
| 60 | + with: |
| 61 | + fetch-depth: 2 |
| 62 | + |
| 63 | + - name: Cache metadata |
| 64 | + id: cache-metadata |
| 65 | + uses: actions/cache@v4 |
| 66 | + with: |
| 67 | + path: util/gh-pages/lints.json |
| 68 | + key: metadata-bin-${{ hashfiles('clippy_lints/**') }} |
| 69 | + |
| 70 | + - name: Collect metadata |
| 71 | + if: steps.cache-metadata.outputs.cache-hit != 'true' |
| 72 | + run: cargo collect-metadata |
| 73 | + |
| 74 | + - name: Upload base JSON |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: head |
| 78 | + path: util/gh-pages/lints.json |
| 79 | + |
| 80 | + # Retrieves the head and base JSON results and prints the diff to the GH actions step summary |
| 81 | + diff: |
| 82 | + runs-on: ubuntu-latest |
| 83 | + |
| 84 | + needs: [base, head] |
| 85 | + |
| 86 | + steps: |
| 87 | + - name: Checkout |
| 88 | + uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - name: Download JSON |
| 91 | + uses: actions/download-artifact@v4 |
| 92 | + |
| 93 | + - name: Diff results |
| 94 | + run: | |
| 95 | + cargo dev check_new_lints_version base/lints.json head/lints.json |
0 commit comments