From ec190e990eb91fdd598f2842d48cd866e9fc57e6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Feb 2026 16:55:01 +0000 Subject: [PATCH 1/5] Initial plan From 4e5501fd6e38b2c2984f88a4c360472d8791f57b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Feb 2026 16:57:21 +0000 Subject: [PATCH 2/5] Distinguish clang-tidy tooling failures from issue detection cmake exits non-zero both when clang-tidy finds issues (fixes YAML populated) and when a tooling failure occurs (fixes YAML absent/empty). The previous `|| true` discarded all non-zero exit codes, masking real failures. Now we capture the exit code and fail the job only when cmake is non-zero AND no fixes YAML was produced. Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com> --- .github/workflows/clang-tidy-check.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/clang-tidy-check.yaml b/.github/workflows/clang-tidy-check.yaml index 88bfe736..b8a69dd5 100644 --- a/.github/workflows/clang-tidy-check.yaml +++ b/.github/workflows/clang-tidy-check.yaml @@ -129,7 +129,15 @@ jobs: cd "$GITHUB_WORKSPACE/phlex-build" echo "➡️ Running clang-tidy checks..." - cmake --build . --target clang-tidy-check -- --export-fixes clang-tidy-fixes.yaml > clang-tidy.log 2>&1 || true + cmake --build . --target clang-tidy-check -- --export-fixes clang-tidy-fixes.yaml > clang-tidy.log 2>&1 + cmake_status=$? + # cmake returns non-zero both when clang-tidy finds issues AND when a tooling + # failure occurs. Distinguish by checking whether the fixes file was populated: + # a non-empty fixes file indicates clang-tidy ran successfully and found issues. + if [ "$cmake_status" -ne 0 ] && [ ! -s clang-tidy-fixes.yaml ]; then + echo "::error::clang-tidy CMake target failed with exit code $cmake_status" + exit "$cmake_status" + fi if [ -s clang-tidy-fixes.yaml ]; then echo "has_issues=true" >> "$GITHUB_OUTPUT" echo "::warning::Clang-tidy found issues in the code" From 014623b7c5d72270af30dbce406b9094677ea8e9 Mon Sep 17 00:00:00 2001 From: Chris Green Date: Tue, 24 Feb 2026 17:15:52 +0000 Subject: [PATCH 3/5] Fix clang-tidy failure detection: check log content not fixes file The previous logic incorrectly used the fixes YAML file to distinguish tooling failures from issue detection. This fails when clang-tidy finds issues without automatic fixes (many checks don't provide auto-fixes). Now checks for diagnostic output in the log to determine if clang-tidy ran successfully. Only fails CI when exit code is non-zero AND no diagnostics are present, indicating a true tooling failure. --- .github/workflows/clang-tidy-check.yaml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/clang-tidy-check.yaml b/.github/workflows/clang-tidy-check.yaml index b8a69dd5..bb4a4def 100644 --- a/.github/workflows/clang-tidy-check.yaml +++ b/.github/workflows/clang-tidy-check.yaml @@ -131,14 +131,16 @@ jobs: echo "➡️ Running clang-tidy checks..." cmake --build . --target clang-tidy-check -- --export-fixes clang-tidy-fixes.yaml > clang-tidy.log 2>&1 cmake_status=$? - # cmake returns non-zero both when clang-tidy finds issues AND when a tooling - # failure occurs. Distinguish by checking whether the fixes file was populated: - # a non-empty fixes file indicates clang-tidy ran successfully and found issues. - if [ "$cmake_status" -ne 0 ] && [ ! -s clang-tidy-fixes.yaml ]; then - echo "::error::clang-tidy CMake target failed with exit code $cmake_status" - exit "$cmake_status" + + # Distinguish tooling failures from issue detection by checking log content + if [ "$cmake_status" -ne 0 ]; then + if ! grep -qE '^/.+\.(cpp|hpp|c|h):[0-9]+:[0-9]+: (warning|error):' clang-tidy.log; then + echo "::error::clang-tidy failed without producing diagnostic output (exit code $cmake_status)" + exit "$cmake_status" + fi fi - if [ -s clang-tidy-fixes.yaml ]; then + + if grep -qE '^/.+\.(cpp|hpp|c|h):[0-9]+:[0-9]+: (warning|error):' clang-tidy.log; then echo "has_issues=true" >> "$GITHUB_OUTPUT" echo "::warning::Clang-tidy found issues in the code" echo "Error count by check (full details in clang-tidy-log artifact):" From 7dbc65f5ed7ae52349ade69bf3750e2771597daf Mon Sep 17 00:00:00 2001 From: Chris Green Date: Tue, 24 Feb 2026 11:27:42 -0600 Subject: [PATCH 4/5] Bypass early exit due to `exit_on_error` Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/clang-tidy-check.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/clang-tidy-check.yaml b/.github/workflows/clang-tidy-check.yaml index bb4a4def..ba6f6377 100644 --- a/.github/workflows/clang-tidy-check.yaml +++ b/.github/workflows/clang-tidy-check.yaml @@ -129,8 +129,8 @@ jobs: cd "$GITHUB_WORKSPACE/phlex-build" echo "➡️ Running clang-tidy checks..." - cmake --build . --target clang-tidy-check -- --export-fixes clang-tidy-fixes.yaml > clang-tidy.log 2>&1 - cmake_status=$? + cmake_status=0 + cmake --build . --target clang-tidy-check -- --export-fixes clang-tidy-fixes.yaml > clang-tidy.log 2>&1 || cmake_status=$? # Distinguish tooling failures from issue detection by checking log content if [ "$cmake_status" -ne 0 ]; then From a5796652316b8d43a33e5a66c6d53d84ece9c700 Mon Sep 17 00:00:00 2001 From: Chris Green Date: Tue, 24 Feb 2026 11:29:46 -0600 Subject: [PATCH 5/5] Remove unwanted whitespace --- .github/workflows/clang-tidy-check.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/clang-tidy-check.yaml b/.github/workflows/clang-tidy-check.yaml index ba6f6377..6aa1009c 100644 --- a/.github/workflows/clang-tidy-check.yaml +++ b/.github/workflows/clang-tidy-check.yaml @@ -131,7 +131,7 @@ jobs: echo "➡️ Running clang-tidy checks..." cmake_status=0 cmake --build . --target clang-tidy-check -- --export-fixes clang-tidy-fixes.yaml > clang-tidy.log 2>&1 || cmake_status=$? - + # Distinguish tooling failures from issue detection by checking log content if [ "$cmake_status" -ne 0 ]; then if ! grep -qE '^/.+\.(cpp|hpp|c|h):[0-9]+:[0-9]+: (warning|error):' clang-tidy.log; then @@ -139,7 +139,7 @@ jobs: exit "$cmake_status" fi fi - + if grep -qE '^/.+\.(cpp|hpp|c|h):[0-9]+:[0-9]+: (warning|error):' clang-tidy.log; then echo "has_issues=true" >> "$GITHUB_OUTPUT" echo "::warning::Clang-tidy found issues in the code"