Skip to content

Commit 6bfe511

Browse files
committed
fix(ci): reuse Clang build for clang-tidy
Export compile commands from the existing Linux Clang build, then run the changed-line clang-tidy analysis after its test suite. Remove the standalone workflow that rebuilt the same source tree. Signed-off-by: Rello <github@scherello.de> Assisted-by: Codex:GPT-5
1 parent 269c4c6 commit 6bfe511

2 files changed

Lines changed: 17 additions & 46 deletions

File tree

.github/workflows/clang-tidy-review.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/linux-clang-compile-tests.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,31 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
1414
with:
15-
fetch-depth: 1
15+
fetch-depth: 2
1616
- name: Configure and compile
1717
run: |
1818
mkdir build
1919
cd build
20-
cmake .. -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DQT_MAJOR_VERSION=6 -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DCMAKE_CXX_FLAGS=-Werror
20+
cmake .. -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DQT_MAJOR_VERSION=6 -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DCMAKE_CXX_FLAGS=-Werror -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
2121
ninja
2222
- name: Run tests
2323
run: |
2424
cd build
2525
useradd -m -s /bin/bash test
2626
chown -R test:test .
2727
su -c 'xvfb-run ctest --output-on-failure' test
28+
- name: Analyze changed C++ code with clang-tidy
29+
run: |
30+
mkdir clang-tidy-result
31+
/usr/bin/git config --global --add safe.directory "$GITHUB_WORKSPACE"
32+
# Header-only test helper: clang-tidy-diff has no target compile command for it.
33+
# Its consumer test targets compile it with the required GUI include paths.
34+
/usr/bin/git diff -U0 HEAD^ -- ':(exclude)test/macOS/*' ':(exclude)test/systraysynccontroltesthelper.h' ':(exclude)*macOS*' | clang-tidy-diff-21.py -checks='-*,modernize-use-auto,modernize-use-using,modernize-use-nodiscard,modernize-use-nullptr,modernize-use-override,cppcoreguidelines-pro-type-static-cast-downcast' -p1 -path build -regex '^(?!.*/macOS/)(?!.*/MacOSX/).*\.(cpp|cc|cxx|c|h|hpp|hxx)$' -export-fixes clang-tidy-result/fixes.yml
35+
- name: Publish clang-tidy review
36+
uses: platisd/clang-tidy-pr-comments@28cfb84edafa771c044bde7e4a2a3fae57463818 # v1.6.1 # >1.4.3 switches to composite method w/ a forced python version and breaks things: https://github.com/actions/setup-python/issues/871
37+
with:
38+
python_path: "/usr/bin/python3"
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
clang_tidy_fixes: clang-tidy-result/fixes.yml
41+
request_changes: true
42+
suggestions_per_comment: 10

0 commit comments

Comments
 (0)