ci(workflows): matrix Windows unit tests on MSVC and clang-cl

Replace the single-compiler `tests-windows-msvc` job with a matrix
job `tests-windows` that runs the Windows shim unit tests under
both native MSVC (cl.exe) and the LLVM clang-cl.exe driver against
the same MSVC headers/CRT. The matrix axis is `compiler: [msvc,
clang-cl]` with `fail-fast: false` so each toolchain reports
independently.

Wire the toolchain selection through the CC/CXX env vars on the
configure step: empty for the MSVC default discovered via vcvars,
or `clang-cl.exe` for the LLVM driver. The remaining steps (build,
ctest, save-ccache) are toolchain-agnostic.

Catches toolchain-specific shim regressions (clang-cl widening of
the MSVC shim gates, fuzztest fallback to FetchContent gtest, the
googletest -Wcharacter-conversion suppression) before they hit the
SITL build path.

Signed-off-by: Nuno Marques <n.marques21@hotmail.com>
This commit is contained in:
Nuno Marques
2026-05-07 18:07:22 -07:00
parent 657b6a89e1
commit c2e5270ec3
+17 -5
View File
@@ -98,14 +98,21 @@ jobs:
run: git diff --exit-code
working-directory: src/modules/ekf2/test/change_indication
tests-windows-msvc:
name: Unit Tests (windows-msvc)
tests-windows:
name: Unit Tests (windows-${{ matrix.compiler }})
# Native Windows host is required: the gtest binaries under
# platforms/posix/src/px4/windows/tests/ exercise the _MSC_VER paths
# in the shim headers and the MSVC-only sources (socket_msvc.cpp,
# sys/time.cpp, etc.). The shim CMakeLists is gated on WIN32 in
# platforms/posix/CMakeLists.txt, so a Linux runner cannot stand in.
# The compiler axis covers both native MSVC (cl.exe) and the LLVM
# clang-cl.exe driver against the same MSVC headers/CRT so we catch
# toolchain-specific shim regressions before they hit the SITL build.
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
compiler: [msvc, clang-cl]
steps:
- uses: actions/checkout@v6
with:
@@ -142,11 +149,16 @@ jobs:
# via px4_posix_windows_add_tests() (see platforms/posix/CMakeLists.txt).
# Pin Python3_ROOT_DIR to the setup-python interpreter so cmake's
# find_package(Python3) does not pick the runner image's other Python
# where kconfiglib is not installed. We invoke cmake directly here
# rather than `make px4_sitl_test` so we only configure and can then
# build a narrow set of targets in the next step.
# where kconfiglib is not installed. The CC/CXX env vars decide which
# toolchain CMake picks: empty for native MSVC (the default cl.exe
# discovered via vcvars), or clang-cl.exe for the LLVM driver. We
# invoke cmake directly here rather than `make px4_sitl_test` so we
# only configure and can then build a narrow set of targets next.
- name: Configure (px4_sitl_test)
shell: pwsh
env:
CC: ${{ matrix.compiler == 'clang-cl' && 'clang-cl' || '' }}
CXX: ${{ matrix.compiler == 'clang-cl' && 'clang-cl' || '' }}
run: |
cmake -S . -B build/px4_sitl_test -G Ninja `
-DCONFIG=px4_sitl_test `