@@ -287,21 +287,39 @@ jobs:
287287          echo "Clearing uv cache at ${UV_CACHE_DIR} due to failure." 
288288          uv cache clean 
289289
290- name : Run format check 
291-         id : format-check 
290+ name : Run clang-tidy 
291+         id : clang-tidy 
292+         if : runner.os == 'Linux' 
292293        run : | 
293-           mkdir -p build 
294+           echo "\$ $(command -v clang-tidy) --version" && clang-tidy --version 
295+ 
296+           if [[ -x "$(command -v run-clang-tidy)" ]]; then 
297+             echo "Using run-clang-tidy from $(command -v run-clang-tidy)" 
298+             CLANG_TIDY=(run-clang-tidy) 
299+           else 
300+             echo "Downloading run-clang-tidy script" 
301+             wget -O run-clang-tidy.py https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/release/21.x/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py 
302+             CLANG_TIDY=(uv run --no-project --script -- run-clang-tidy.py) 
303+           fi 
304+           if [[ -x "$(command -v clang-apply-replacements)" ]]; then 
305+             echo "Using clang-apply-replacements from $(command -v clang-apply-replacements)" 
306+             CLANG_TIDY+=(-fix -clang-apply-replacements-binary="$(command -v clang-apply-replacements)") 
307+           else 
308+             echo "::warning::clang-apply-replacements not found in PATH, automatic fixing disabled." 
309+           fi 
310+ 
294311          # Run cmake to create the build directory with compile_commands.json 
295-           ( 
296-             cd build 
297-             cmake .. ${CLANG_TIDY_CMAKE_OPTIONS}  # no quotes here 
298-           ) 
312+           cmake -S . -B cmake-build --fresh ${CLANG_TIDY_CMAKE_OPTIONS}  # no quotes here 
313+ 
314+           CXX_FILES=$(find src -type f -iname "*.[ch]pp" -o -iname "*.cc" -o -iname "*.c" -o -iname "*.h") 
299315          rc=0 
300-           bash format.sh || rc="$?" 
301-           rm -rf build 
302-           if [[ "${rc}" -ne 0 ]]; then 
303-             echo "::error::Format check failed. Please run 'bash format.sh' locally to fix the issues." 
304-             exit 1 
316+           "${CLANG_TIDY[@]}" -clang-tidy-binary="$(command -v clang-tidy)" \ 
317+             -p="cmake-build" ${CXX_FILES} || rc="$?" 
318+           rm -rf cmake-build run-clang-tidy.py 
319+           if (( rc != 0 )); then 
320+             echo "::error::clang-tidy found issues (exit code: ${rc}). Please run 'clang-tidy --fix' locally to fix them." 
321+             git diff --color=always || true  
322+             exit "${rc}" 
305323          fi 
306324
307325name : Enable core dump generation (Linux / GitHub-hosted runners) 
0 commit comments