|
1 | 1 | name: Static Analysis |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_dispatch: |
| 4 | + pull_request: |
5 | 5 |
|
6 | 6 | jobs: |
7 | 7 | clang-tidy: |
8 | | - runs-on: self-hosted |
9 | | - if: github.repository_owner == 'deepmodeling' |
| 8 | + runs-on: ubuntu-latest |
10 | 9 | container: ghcr.io/deepmodeling/abacus-development-kit:gnu |
11 | 10 | steps: |
12 | 11 | - name: Checkout Pull Request |
13 | | - uses: actions/checkout@v2 |
| 12 | + uses: actions/checkout@v3 |
14 | 13 | with: |
15 | | - ref: ${{ github.event.pull_request.head.sha }} |
| 14 | + fetch-depth: 2 |
16 | 15 | - name: Setup clang-tidy |
17 | 16 | run: | |
18 | 17 | apt-get update && apt-get install -y --no-install-recommends clang-format clang-tidy |
19 | 18 | - name: Generate Build Commands |
20 | 19 | run: | |
21 | 20 | cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=1 |
22 | | - - name: Checkout Changed Files |
23 | | - id: files |
24 | | - uses: deepmodeling/get-changed-files@master |
25 | 21 | - name: Run clang-tidy |
26 | 22 | run: | |
27 | | - printf "%s\n" ${{ steps.files.outputs.added_modified }} | grep -E "^.*\.(cpp|h)$" > cppfiles.txt |
28 | | - clang-tidy -p=build --export-fixes=diagnostics.yaml `cat cppfiles.txt` |
29 | | - - name: Run clang-tidy-pr-comments action |
30 | | - uses: deepmodeling/abacus-code-reviewer@master |
| 23 | + git diff -U0 HEAD^ | clang-tidy-diff -p1 -path build -export-fixes fixes.yml |
| 24 | + - name: Pull request comments from clang-tidy reports |
| 25 | + |
31 | 26 | with: |
32 | 27 | # The GitHub token (or a personal access token) |
33 | 28 | github_token: ${{ secrets.GITHUB_TOKEN }} |
34 | 29 | # The path to the clang-tidy fixes generated previously |
35 | | - clang_tidy_fixes: diagnostics.yaml |
| 30 | + clang_tidy_fixes: fixes.yml |
36 | 31 | # Optionally set to true if you want the Action to request |
37 | 32 | # changes in case warnings are found |
38 | | - request_changes: true |
| 33 | + request_changes: false |
39 | 34 | # Optionally set the number of comments per review |
40 | 35 | # to avoid GitHub API timeouts for heavily loaded |
41 | 36 | # pull requests |
|
0 commit comments