@@ -124,3 +124,109 @@ jobs:
124
124
export return=$(tail -n 1 clang-tidy-warnings.txt | awk '{print $2}')
125
125
exit ${return}
126
126
127
+ PeleC-clang-tidy :
128
+ name : PeleC clang-tidy
129
+ runs-on : ubuntu-24.04
130
+
131
+ env :
132
+ BUILD_DIR : ${{ github.workspace }}/build-clang-tidy-c
133
+
134
+ steps :
135
+ - name : Checkout PelePhysics
136
+ uses : actions/checkout@v4
137
+ with :
138
+ path : pelephysics-pr
139
+ fetch-depth : 0
140
+
141
+ - name : Clone PeleC
142
+ run : |
143
+ git clone --recursive --shallow-submodules --single-branch \
144
+ https://github.com/AMReX-Combustion/PeleC
145
+
146
+ - name : Point PeleC/Submodules/PelePhysics to this PR
147
+ working-directory : PeleC
148
+ shell : bash
149
+ run : |
150
+ # Allow use of file:// remotes for submodules
151
+ git config --global protocol.file.allow always
152
+
153
+ # Point the submodule to the checked-out PR
154
+ git config -f .gitmodules submodule.Submodules/PelePhysics.url "file://$GITHUB_WORKSPACE/pelephysics-pr"
155
+ git submodule sync -- Submodules/PelePhysics
156
+ git submodule update --init --depth 1 -- Submodules/PelePhysics
157
+
158
+ echo "Submodule now points to:"
159
+ git -C Submodules/PelePhysics rev-parse --short HEAD
160
+
161
+ - name : Setup
162
+ run : |
163
+ echo "NPROCS=$(nproc)" >> $GITHUB_ENV
164
+ echo "CCACHE_COMPRESS=1" >> $GITHUB_ENV
165
+ echo "CCACHE_COMPRESSLEVEL=10" >> $GITHUB_ENV
166
+ echo "CCACHE_LOGFILE=${{github.workspace}}/ccache.log.txt" >> $GITHUB_ENV
167
+ echo "CCACHE_EXTRAFILES=${{github.workspace}}/PeleC/.clang-tidy" >> $GITHUB_ENV
168
+ echo "CCACHE_MAXSIZE=100M" >> $GITHUB_ENV
169
+ echo "CTCACHE_DIR=~/.cache/ctcache" >> $GITHUB_ENV
170
+
171
+ - name : Install Ccache
172
+ run : |
173
+ wget https://github.com/ccache/ccache/releases/download/v4.8/ccache-4.8-linux-x86_64.tar.xz
174
+ sudo curl https://raw.githubusercontent.com/matus-chochlik/ctcache/7fd516e91c17779cbc6fc18bd119313d9532dd90/clang-tidy-cache -Lo /usr/bin/clang-tidy-cache
175
+ tar xvf ccache-4.8-linux-x86_64.tar.xz
176
+ sudo cp -f ccache-4.8-linux-x86_64/ccache /usr/local/bin/
177
+ sudo chmod +x /usr/bin/clang-tidy-cache
178
+ mkdir -p ~/.cache/ctcache
179
+
180
+ - name : Set Up Ccache
181
+ uses : actions/cache@v4
182
+ with :
183
+ path : ~/.cache
184
+ key : ccache-${{github.workflow}}-${{github.job}}-git-${{github.sha}}
185
+ restore-keys : |
186
+ ccache-${{github.workflow}}-${{github.job}}-git-
187
+
188
+ - name : Configure
189
+ working-directory : PeleC
190
+ run : |
191
+ cmake -B"${BUILD_DIR}" \
192
+ -DCMAKE_BUILD_TYPE:STRING=Release \
193
+ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
194
+ -DCMAKE_CXX_COMPILER:STRING=clang++ \
195
+ -DCMAKE_C_COMPILER:STRING=clang \
196
+ -DPELE_ENABLE_MPI:BOOL=OFF \
197
+ -DPELE_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
198
+ -DPELE_ENABLE_MASA:BOOL=OFF \
199
+ -DPELE_ENABLE_CLANG_TIDY:BOOL=ON \
200
+ -DPELE_EXCLUDE_BUILD_IN_CI:BOOL=ON \
201
+ -DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
202
+ ${{github.workspace}}/PeleC
203
+
204
+ - name : Check
205
+ working-directory : ${{ env.BUILD_DIR }}
206
+ run : |
207
+ cmake --build . --parallel ${{ env.NPROCS }} 2>&1 | tee -a clang-tidy-full-report.txt
208
+ egrep "Warning:|Error:|warning:|error:" clang-tidy-full-report.txt \
209
+ | egrep -v "Submodules/amrex|Submodules/sundials|Submodules/AMReX-Hydro" \
210
+ | egrep -v "ld: warning:" | sort | uniq \
211
+ | awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > clang-tidy-warnings.txt
212
+
213
+ - name : Ccache Report
214
+ run : |
215
+ ls ~/.cache
216
+ ls ~/.cache/ccache
217
+ du -hs ~/.cache/ccache
218
+ ls ~/.cache/ctcache
219
+ du -hs ~/.cache/ctcache
220
+ ccache -s
221
+
222
+ - name : Full report
223
+ working-directory : ${{ env.BUILD_DIR }}
224
+ run : cat clang-tidy-full-report.txt
225
+
226
+ - name : Short report
227
+ working-directory : ${{ env.BUILD_DIR }}
228
+ run : |
229
+ echo "::add-matcher::${{ github.workspace }}/PeleC/.github/problem-matchers/gcc.json"
230
+ cat clang-tidy-warnings.txt
231
+ export return=$(tail -n 1 clang-tidy-warnings.txt | awk '{print $2}')
232
+ exit ${return}
0 commit comments