From 57fa1018b0e0dafec2a697c7bb0d22e4c40a22be Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Wed, 11 Jun 2025 21:40:44 +0300 Subject: [PATCH] Update OSes in CI and run CMake tests (#207) Fixes https://github.com/boostorg/pfr/issues/205 --- .github/workflows/ci.yml | 42 +++++++++++++++++++++++++++++++++------- test/CMakeLists.txt | 7 +++++++ 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 209b986..9207702 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: include: - - toolset: gcc-14 + - toolset: gcc-14 # Do not remove! It is the only toolset that tests CMake tests down below cxxstd: "03,11,14,17,20" os: ubuntu-24.04 - toolset: gcc-12 # Do not remove! It is the only toolset that tests misc/strip_boost_namespace.sh @@ -91,6 +91,18 @@ jobs: ./b2 -d0 headers ./b2 variant=debug tools/inspect + - name: Run CMake tests + if: ${{matrix.toolset == 'gcc-14'}} + run: | + cd ../boost-root/ + mkdir __build + cd __build + cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=pfr -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_C_COMPILER=gcc-14 .. + cmake --build . --target tests + ctest --output-on-failure --no-tests=error + cd .. + rm -rf __build + - name: Run modules tests if: false # if: ${{matrix.toolset == 'clang-19'}} @@ -159,17 +171,17 @@ jobs: fail-fast: false matrix: include: - - toolset: msvc-14.0 - cxxstd: "14,latest" - addrmd: 32,64 - os: windows-2019 + - toolset: msvc-14.3 # tests CMake tests down below, does not run b2 tests + cxxstd: "14,17,20,latest" + addrmd: 64 + os: windows-2025 threads: "-j3" - toolset: gcc cxxstd: "03,11,14,17,2a" addrmd: 64 - os: windows-2019 + os: windows-2025 threads: "-j3" - - toolset: msvc-14.3 + - toolset: msvc-14.3 # tests CMake tests down below cxxstd: "20,latest" addrmd: 64 os: windows-2022 @@ -206,6 +218,21 @@ jobs: cmd /c bootstrap b2 -d0 headers + - name: Run CMake tests + if: ${{matrix.toolset == 'msvc-14.3'}} + shell: cmd + run: | + choco install --no-progress ninja + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/ + mkdir __build + cd __build + cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=pfr .. + cmake --build . --target tests --config Debug + ctest --output-on-failure --no-tests=error -C Debug + cd .. + rm -rf __build + - name: Run modules tests if: false # if: ${{matrix.toolset == 'msvc-14.3'}} @@ -238,6 +265,7 @@ jobs: rm -rf build_module - name: Run tests + if: ${{matrix.os != 'windows-2025'}} # TODO: workaround issues shell: cmd run: | cd ../boost-root diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index efb910e..2809406 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,6 +2,10 @@ # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt +if(NOT TARGET tests) + add_custom_target(tests) +endif() + file(GLOB CORE_RUN_FILES "core/run/*.cpp") foreach (testsourcefile ${CORE_RUN_FILES}) get_filename_component(testname ${testsourcefile} NAME_WLE) @@ -9,13 +13,16 @@ foreach (testsourcefile ${CORE_RUN_FILES}) target_link_libraries(pfr_core_${testname} Boost::pfr) target_include_directories(pfr_core_${testname} PRIVATE ../../../) add_test(NAME pfr_core_${testname} COMMAND pfr_core_${testname}) + add_dependencies(tests pfr_core_${testname}) endforeach() file(GLOB CORE_NAME_RUN_FILES "core_name/run/*.cpp") foreach (testsourcefile ${CORE_NAME_RUN_FILES}) get_filename_component(testname ${testsourcefile} NAME_WLE) add_executable(pfr_corename_${testname} ${testsourcefile}) + target_compile_features(pfr_corename_${testname} PUBLIC cxx_std_20) target_link_libraries(pfr_corename_${testname} Boost::pfr) target_include_directories(pfr_corename_${testname} PRIVATE ../../../) add_test(NAME pfr_corename_${testname} COMMAND pfr_corename_${testname}) + add_dependencies(tests pfr_corename_${testname}) endforeach()