Skip to content

Commit b68d6e9

Browse files
fix: CI infrastructure, clang-tidy + Conan, and platform fixes
- Fix clang-tidy + Conan: remove -p flag from StaticAnalyzers.cmake so CMake passes full compile command (including -isystem paths) directly to clang-tidy - Disable misc-include-cleaner in .clang-tidy (noisy false positives) - Disable clang-tidy on test targets (Catch2 macro false positives) - Fix macOS GCC: pre-install Conan deps with libstdc++11 profile - Skip GCC --coverage on macOS ARM (Apple linker can't find libgcov) - Install lizard in CI and WASM workflows - Disable Bloaty/IWYU in CI (not available on runners) - Pin Emscripten to 3.1.74 (Conan doesn't support emcc 23+) - Fix auto-clang-format PR checkout (github.head_ref) - Add myproject_SKIP_CONAN_PROVIDER option to cmake/Conan.cmake - Add CI_KNOWN_ISSUES.md Signed-off-by: Helder Ferreira <helder@versatushpc.com.br> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3aa3b70 commit b68d6e9

11 files changed

Lines changed: 126 additions & 17 deletions

File tree

.clang-tidy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Checks: "*,
1515
-misc-non-private-member-variables-in-classes,
1616
-misc-no-recursion,
1717
-misc-use-anonymous-namespace,
18-
-misc-use-internal-linkage
18+
-misc-use-internal-linkage,
19+
-misc-include-cleaner
1920
"
2021
WarningsAsErrors: ''
2122
HeaderFilterRegex: '(include|src)/'

.github/workflows/auto-clang-format.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ jobs:
77

88
steps:
99
- uses: actions/checkout@v6
10+
with:
11+
ref: ${{ github.head_ref }}
1012
- uses: DoozyX/clang-format-lint-action@v0.20
1113
with:
1214
source: '.'

.github/workflows/ci.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,43 @@ jobs:
161161
gcovr: true
162162
opencppcoverage: true
163163

164-
- name: Install Conan
165-
run: pip install conan
164+
- name: Install Conan and Lizard
165+
run: pip install conan lizard
166+
167+
- name: Pre-install Conan deps for macOS GCC
168+
if: ${{ runner.os == 'macOS' && contains(matrix.compiler, 'gcc') }}
169+
run: |
170+
# GCC on macOS uses libstdc++, but the cmake-conan provider
171+
# auto-detects Apple Clang and builds packages with libc++.
172+
# Pre-install deps with a GCC profile and skip the provider.
173+
conan profile detect --force
174+
GCC_VER=$(echo "${{ matrix.compiler }}" | grep -o '[0-9]*')
175+
cat > ~/.conan2/profiles/default << PROFILE
176+
[settings]
177+
arch=armv8
178+
build_type=Release
179+
compiler=gcc
180+
compiler.cppstd=23
181+
compiler.libcxx=libstdc++11
182+
compiler.version=$GCC_VER
183+
os=Macos
184+
[conf]
185+
tools.build:compiler_executables={"c": "gcc-$GCC_VER", "cpp": "g++-$GCC_VER"}
186+
PROFILE
187+
cat ~/.conan2/profiles/default
188+
conan install . --output-folder=build --build=missing -s build_type=Debug
189+
conan install . --output-folder=build --build=missing -s build_type=Release
190+
conan install . --output-folder=build --build=missing -s build_type=RelWithDebInfo
166191
167192
- name: Configure CMake
193+
shell: bash
168194
run: |
169-
cmake -S . -B ./build -G "${{matrix.generator}}" -D${{ env.PROJECT_NAME }}_ENABLE_IPO=${{matrix.enable_ipo }} -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -D${{ env.PROJECT_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.packaging_maintainer_mode}} -D${{ env.PROJECT_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }}
195+
EXTRA_CMAKE_ARGS=""
196+
# macOS GCC: deps pre-installed with libstdc++11 profile
197+
if [[ "${{ runner.os }}" == "macOS" && "${{ matrix.compiler }}" =~ gcc ]]; then
198+
EXTRA_CMAKE_ARGS="-Dmyproject_SKIP_CONAN_PROVIDER=ON -DCMAKE_PREFIX_PATH=$PWD/build"
199+
fi
200+
cmake -S . -B ./build -G "${{matrix.generator}}" $EXTRA_CMAKE_ARGS -D${{ env.PROJECT_NAME }}_ENABLE_IPO=${{matrix.enable_ipo }} -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -D${{ env.PROJECT_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.packaging_maintainer_mode}} -D${{ env.PROJECT_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -D${{ env.PROJECT_NAME }}_ENABLE_BLOATY:BOOL=OFF -D${{ env.PROJECT_NAME }}_ENABLE_INCLUDE_WHAT_YOU_USE:BOOL=OFF -DGIT_SHA:STRING=${{ github.sha }}
170201
171202
- name: Build
172203
# Execute the build. You can specify a specific target with "--target <NAME>"
@@ -205,7 +236,7 @@ jobs:
205236
- name: Publish to codecov
206237
uses: codecov/codecov-action@v5
207238
with:
208-
fail_ci_if_error: true # we weren't posting previously
239+
fail_ci_if_error: true
209240
flags: ${{ runner.os }}
210241
name: ${{ runner.os }}-coverage
211242
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/wasm.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,20 @@ jobs:
2020
- name: Setup Emscripten
2121
uses: mymindstorm/setup-emsdk@v14
2222
with:
23-
version: 'latest'
23+
# Pin to 3.1.x — Conan's settings.yml doesn't support emcc 23+ yet
24+
version: '3.1.74'
2425

25-
- name: Install Ninja and Conan
26+
- name: Install Ninja, Conan, and Lizard
2627
run: |
2728
sudo apt-get install -y ninja-build
28-
pip install conan
29+
pip install conan lizard
2930
3031
- name: Configure CMake
31-
run: emcmake cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
32+
run: |
33+
emcmake cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
34+
-Dmyproject_ENABLE_BLOATY=OFF \
35+
-Dmyproject_ENABLE_INCLUDE_WHAT_YOU_USE=OFF \
36+
-Dmyproject_ENABLE_CLANG_TIDY=OFF
3237
3338
- name: Build all WASM targets
3439
run: emmake cmake --build build --target web-dist

CI_KNOWN_ISSUES.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# CI Known Issues
2+
3+
This document tracks CI limitations and their resolutions. Most issues
4+
stemmed from the migration from CPM/FetchContent to Conan 2.0.
5+
6+
## clang-tidy and Conan include paths (RESOLVED)
7+
8+
**Status:** Fixed by removing the `-p` flag from `StaticAnalyzers.cmake`.
9+
10+
**Root cause:** The `-p` flag in `CMAKE_CXX_CLANG_TIDY` options told CMake
11+
to have clang-tidy use `compile_commands.json` instead of passing the full
12+
compile command directly. This broke include resolution for Conan packages
13+
whose headers live in external `-isystem` paths (`~/.conan2/p/...`). Without
14+
`-p`, CMake appends `-- <full compile command>` to clang-tidy, which includes
15+
all `-isystem` paths and works reliably with Conan.
16+
17+
## macOS + GCC Conan ABI (RESOLVED)
18+
19+
**Status:** Fixed by overriding the Conan profile for macOS GCC in CI.
20+
21+
**Root cause:** Conan's default macOS profile detects Apple Clang and sets
22+
`compiler.libcxx=libc++`. When building with GCC 14 (which uses `libstdc++`),
23+
this causes ABI mismatches at link time. Fixed by creating a GCC-specific
24+
Conan profile with `compiler=gcc` and `compiler.libcxx=libstdc++11`.
25+
26+
## codecov fail_ci_if_error (RESOLVED)
27+
28+
**Status:** Set to `true`. Requires `CODECOV_TOKEN` repository secret.
29+
30+
**Setup:** Add `CODECOV_TOKEN` to the repository secrets at
31+
`Settings > Secrets and variables > Actions`. The token is obtained from
32+
[codecov.io](https://codecov.io) after linking the repository. Derived repos
33+
must configure their own token.
34+
35+
## GCC coverage on macOS ARM
36+
37+
**Status:** Skipped in `cmake/Tests.cmake` when `APPLE AND GNU`.
38+
39+
**Root cause:** GCC's `--coverage` flag links against `libgcov`, which
40+
Apple's ARM linker can't find. Tests still run and pass; only coverage
41+
instrumentation is skipped. GCC coverage works on Linux.
42+
43+
## Intel ICX coverage
44+
45+
**Status:** gcovr skipped when `matrix.compiler == intel` in `ci.yml`.
46+
47+
**Root cause:** Intel ICX produces coverage data in a format incompatible
48+
with `gcov`. Tests still run and pass; only the coverage report is skipped.
49+
50+
**Possible fix:** Use `llvm-cov` from the oneAPI toolkit to process ICX
51+
coverage data. Nice-to-have, not a blocker.

cmake/Conan.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#
77
# This file must be included BEFORE the project() call.
88

9+
option(myproject_SKIP_CONAN_PROVIDER "Skip the Conan CMake provider (use pre-installed deps)" OFF)
10+
if(myproject_SKIP_CONAN_PROVIDER)
11+
return()
12+
endif()
13+
914
set(CONAN_PROVIDER_LOCATION "${CMAKE_BINARY_DIR}/cmake/conan_provider.cmake")
1015

1116
if(NOT EXISTS "${CONAN_PROVIDER_LOCATION}")

cmake/StaticAnalyzers.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,17 @@ macro(myproject_enable_clang_tidy target WARNINGS_AS_ERRORS)
7474
endif()
7575

7676
# construct the clang-tidy command line
77+
# NOTE: Do not add -p here. With -p, CMake tells clang-tidy to use
78+
# compile_commands.json instead of passing the full compile command
79+
# directly. This breaks include resolution for Conan packages whose
80+
# headers live in external -isystem paths outside the build tree.
81+
# Without -p, CMake appends "-- <full compile command>" to clang-tidy,
82+
# which includes all -isystem paths and works reliably.
7783
set(CLANG_TIDY_OPTIONS
7884
${CLANGTIDY}
7985
-extra-arg=-Wno-unknown-warning-option
8086
-extra-arg=-Wno-ignored-optimization-argument
81-
-extra-arg=-Wno-unused-command-line-argument
82-
-p)
87+
-extra-arg=-Wno-unused-command-line-argument)
8388
# set standard
8489
if(NOT
8590
"${CMAKE_CXX_STANDARD}"

cmake/Tests.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
function(myproject_enable_coverage project_name)
22
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
3+
# GCC's --coverage flag doesn't work on macOS ARM (Apple linker
4+
# can't find libgcov). Skip coverage for GCC on Apple platforms.
5+
if(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
6+
message(WARNING "Coverage disabled: GCC --coverage is not supported on macOS ARM")
7+
return()
8+
endif()
39
target_compile_options(${project_name} INTERFACE --coverage -g)
410
target_link_libraries(${project_name} INTERFACE --coverage)
511
endif()

include/myproject/sample_library.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <myproject/sample_library_export.hpp>
55

6-
[[nodiscard]] SAMPLE_LIBRARY_EXPORT int factorial(int) noexcept;
6+
[[nodiscard]] SAMPLE_LIBRARY_EXPORT int factorial(int input) noexcept;
77

88
[[nodiscard]] constexpr int factorial_constexpr(int input) noexcept {
99
if (input == 0) {

src/ftxui_sample/main.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,9 @@ struct Color {
207207

208208
// A simple way of representing a bitmap on screen using only characters
209209
struct Bitmap : ftxui::Node {
210-
Bitmap(std::size_t width,
211-
std::size_t
212-
height) // NOLINT same typed parameters adjacent to each other
213-
: width_(width)
214-
, height_(height) {}
210+
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
211+
Bitmap(std::size_t width, std::size_t height)
212+
: width_(width), height_(height) {}
215213

216214
Color& at(std::size_t cur_x, std::size_t cur_y) {
217215
return pixels.at((width_ * cur_y) + cur_x);

0 commit comments

Comments
 (0)