Skip to content

Commit 06a9636

Browse files
committed
add summary
1 parent 4af3618 commit 06a9636

File tree

1 file changed

+40
-10
lines changed

1 file changed

+40
-10
lines changed

.github/workflows/clang-tidy.yml

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ jobs:
1212

1313
steps:
1414
- name: Checkout repository
15-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4
15+
uses: actions/checkout@v4
1616

1717
- name: Install clang tidy dependencies
1818
run: |
1919
sudo apt update
2020
sudo apt install -y clang clang-tidy cmake g++ ninja-build
21-
2221
- name: Install SDK dependencies
2322
run: |
2423
sudo apt update
@@ -27,7 +26,6 @@ jobs:
2726
sudo apt-get install -qq libgtk-3-dev;
2827
sudo apt-get install libglfw3-dev libglfw3;
2928
30-
3129
- name: Configure project with CMake
3230
run: |
3331
cmake -S . -B build \
@@ -39,7 +37,6 @@ jobs:
3937
- name: Build project
4038
run: cmake --build build -j$(nproc)
4139

42-
# 👇 This stage writes the .clang-tidy file
4340
- name: Create .clang-tidy config
4441
run: |
4542
cat <<'EOF' > .clang-tidy
@@ -53,9 +50,10 @@ jobs:
5350
modernize-use-nullptr,
5451
modernize-use-override,
5552
modernize-use-auto,
56-
misc-unused-parameters
57-
WarningsAsErrors: '*'
58-
HeaderFilterRegex: 'src/.*'
53+
misc-unused-parameters,
54+
misc-strcmp
55+
# WarningsAsErrors: '*' # <-- Commented out to not fail on all warnings
56+
HeaderFilterRegex: 'src/(?!third-party).*' # consider adding some third party that are not actually third party like realdds
5957
FormatStyle: none
6058
CheckOptions:
6159
- key: readability-implicit-bool-conversion.AllowIntegerConditions
@@ -67,9 +65,41 @@ jobs:
6765
echo "Running clang-tidy..."
6866
cp build/compile_commands.json .
6967
clang-tidy -p . $(find src -name '*.cpp') 2>&1 | tee clang-tidy.log
70-
if grep -E "warning:|error:" clang-tidy.log; then
71-
echo "❌ Clang-Tidy found issues."
68+
69+
# === NEW: Extract errors only to a separate log ===
70+
- name: Extract errors from clang-tidy log
71+
run: |
72+
awk '/error:/ && !/\[clang-diagnostic-error\]/' clang-tidy.log > clang-tidy-errors.log
73+
74+
# === NEW: Summarize only errors at the end ===
75+
- name: Errors Only Summary
76+
run: |
77+
echo "Clang-Tidy Errors Only Summary:"
78+
total_errors=$(cat clang-tidy-errors.log | wc -l)
79+
echo ""
80+
echo "Total errors found: $total_errors"
81+
echo ""
82+
if (( total_errors > 0 )); then
83+
echo "Top error types:"
84+
grep -oE '\[[^][]+\]' clang-tidy-errors.log | sort | uniq -c | sort -nr | head -20
85+
echo ""
86+
echo "CI failed due to errors. See clang-tidy-errors.log for details."
7287
exit 1
7388
else
74-
echo "✅ Clang-Tidy passed cleanly."
89+
echo "✅ No clang-tidy errors found."
7590
fi
91+
92+
- name: Upload full clang-tidy log as Artifact
93+
if: always()
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: clang-tidy-log
97+
path: clang-tidy.log
98+
99+
# === NEW: Upload errors-only log as artifact ===
100+
- name: Upload clang-tidy errors-only log as Artifact
101+
if: always()
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: clang-tidy-errors-log
105+
path: clang-tidy-errors.log

0 commit comments

Comments
 (0)