@@ -27,56 +27,71 @@ jobs:
27
27
uses : fkirc/skip-duplicate-actions@master
28
28
with :
29
29
cancel_others : ' true'
30
- paths : ' [ "**.cpp", "**.h", "**.c", "**/CMakeLists.txt", "**/Makefile", "**.hpp", "**.cmake", "build-scripts/clang-tidy.sh", "build-scripts/clang-tidy-wrapper.sh", "build-scripts/get_affected_files.py", ".github/workflows/clang-tidy.yml" ]'
31
- build :
30
+ paths : ' [ "**.cpp", "**.h", "**.c", "**/CMakeLists.txt", "**/Makefile", "**.hpp", "**.cmake", "build-scripts/clang-tidy-build.sh", "build-scripts/clang-tidy-run.sh", "build-scripts/clang-tidy-wrapper.sh", "build-scripts/get_affected_files.py", ".github/workflows/clang-tidy.yml" ]'
31
+
32
+
33
+ build-clang-tidy :
32
34
needs : skip-duplicates
35
+ strategy :
36
+ fail-fast : true
37
+ runs-on : ubuntu-24.04
38
+ env :
39
+ COMPILER : clang++-17
40
+ steps :
41
+ - name : install LLVM 17
42
+ if : ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
43
+ run : |
44
+ sudo apt install llvm-17 llvm-17-dev llvm-17-tools clang-17 clang-tidy-17 clang-tools-17 libclang-17-dev
45
+ sudo apt install python3-pip ninja-build cmake
46
+ pip3 install --user lit
47
+ - name : checkout repository
48
+ uses : actions/checkout@v4
49
+ - uses : ammaraskar/gcc-problem-matcher@master
50
+ - name : build clang-tidy plugin
51
+ if : ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
52
+ run : bash ./build-scripts/clang-tidy-build.sh
53
+ - name : upload plugin
54
+ uses : actions/upload-artifact@v4
55
+ with :
56
+ name : cata-analyzer-plugin
57
+ path : build/tools/clang-tidy-plugin/libCataAnalyzerPlugin.so
58
+ retention-days : 1
59
+
33
60
61
+ run-clang-tidy :
62
+ needs : build-clang-tidy
34
63
strategy :
35
64
fail-fast : false
36
65
matrix :
37
- # To make the run finish in the run time limit, we split it up into two
38
- # parts: the src directory and everything else
66
+ # To make the run finish in the run time limit, we split it up into three parts:
67
+ # the files explicitly changed in the pr, the src directory and everything else
39
68
subset : [
40
69
' directly-changed' ,
41
70
' indirectly-changed-src' ,
42
71
' indirectly-changed-other'
43
72
]
44
73
45
- runs-on : ubuntu-22 .04
74
+ runs-on : ubuntu-24 .04
46
75
env :
47
- CMAKE : 1
48
- CLANG : clang++-17
49
76
COMPILER : clang++-17
50
- CATA_CLANG_TIDY : plugin
77
+ CATA_CLANG_TIDY : clang-tidy-17
51
78
CATA_CLANG_TIDY_SUBSET : ${{ matrix.subset }}
52
79
TILES : 1
53
80
SOUND : 1
54
- RELEASE : 1
81
+ LOCALIZE : 1
55
82
steps :
56
- - name : install LLVM 17
57
- if : ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
58
- run : |
59
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
60
- sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
61
- sudo apt update
62
- sudo apt install llvm-17 llvm-17-dev llvm-17-tools clang-17 clang-tidy-17 clang-tools-17 \
63
- libclang-17-dev libflac-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev \
64
- libpulse-dev ccache gettext jq
65
83
- name : install dependencies
66
- run : |
67
- sudo apt install python3-pip libncursesw5-dev ninja-build cmake gettext
68
- pip3 install --user lit
69
- - name : ensure clang-tidy and FileCheck commands point to LLVM 17
70
84
if : ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
71
85
run : |
72
- mkdir ~/llvm-command-override
73
- ln -s /usr/bin/clang-tidy-17 ~/llvm-command-override/clang-tidy
74
- ln -s /usr/bin/FileCheck-17 ~/llvm-command-override/FileCheck
75
- echo "$HOME/llvm-command-override" >> $GITHUB_PATH
86
+ sudo apt install clang-17 clang-tidy-17 cmake ccache jq
87
+ sudo apt install libflac-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libpulse-dev gettext
76
88
- name : checkout repository
77
89
uses : actions/checkout@v4
78
- - name : prepare
79
- run : bash ./build-scripts/requirements.sh
90
+ - name : download plugin from the previous job in this workflow run
91
+ uses : actions/download-artifact@v4
92
+ with :
93
+ name : cata-analyzer-plugin
94
+ path : build/tools/clang-tidy-plugin/
80
95
- name : determine changed files
81
96
if : ${{ github.event_name == 'pull_request' }}
82
97
uses : actions/github-script@v7
98
113
- uses : ammaraskar/gcc-problem-matcher@master
99
114
- name : run clang-tidy
100
115
if : ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
101
- run : bash ./build-scripts/clang-tidy.sh
116
+ run : bash ./build-scripts/clang-tidy-run .sh
102
117
- name : show most time consuming checks
103
118
if : always()
104
119
run : | # the folder may not exist if there is no file to analyze
0 commit comments