From f441784705f8ac079d686a31145ef37a10beb6b7 Mon Sep 17 00:00:00 2001 From: yaito3014 Date: Thu, 19 Nov 2026 11:15:16 +0900 Subject: [PATCH 1/5] Select the MSVC toolset by prefix with yaito3014/setup-msvc The windows-2025-vs2026 runner image 20261116.315 replaces MSVC 14.51 with 14.52, so the pinned toolset_version 14.51 fails in setup once a job lands on it. Select the newest toolset matching "14.5" instead, and pass its full version to CMake's -T in both configure steps so MSBuild uses that exact toolset rather than the VS default. Bump the deps cache key, since cached FetchContent sub-builds record the -T value. This replaces build.yml's compiler-toolset-version and vs-path inputs with msvc-toolset-prefix and msvc-platform-toolset; x4 must update its caller accordingly. --- .github/actions/setup-cpp/action.yml | 22 +++++++++++----------- .github/workflows/build.yml | 12 ++++++++---- .github/workflows/ci.yml | 10 ++++++---- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/.github/actions/setup-cpp/action.yml b/.github/actions/setup-cpp/action.yml index 451bde8..9d77579 100644 --- a/.github/actions/setup-cpp/action.yml +++ b/.github/actions/setup-cpp/action.yml @@ -17,13 +17,9 @@ inputs: required: true compiler-executable: required: true - compiler-toolset-version: + msvc-toolset-prefix: + description: Version prefix of the MSVC toolset; the newest installed match is used (e.g. 14.5) required: false - type: string - default: '' - vs-path: - required: false - type: string default: '' cpp-version-name: required: true @@ -34,6 +30,9 @@ outputs: compiler-full-version: description: Full version string of the compiler value: ${{ steps.env-info.outputs.compiler-full-version }} + msvc-toolset: + description: Full version of the selected MSVC toolset (e.g. 14.52.37025) + value: ${{ steps.setup-msvc.outputs.toolset }} deps-cache-key: description: Cache key for CMake dependencies value: ${{ steps.env-info.outputs.deps-cache-key }} @@ -64,12 +63,13 @@ runs: sudo ./llvm.sh ${{ inputs.compiler-version }} sudo apt-get install -y libc++-${{ inputs.compiler-version }}-dev libc++abi-${{ inputs.compiler-version }}-dev libunwind-${{ inputs.compiler-version }}-dev - - uses: TheMrMilchmann/setup-msvc-dev@v3 - if: inputs.os-name == 'windows' + - name: Setup MSVC + id: setup-msvc + if: inputs.compiler-toolset == 'msvc' + uses: yaito3014/setup-msvc@v0.1.1 with: + toolset-prefix: ${{ inputs.msvc-toolset-prefix }} arch: x64 - vs-path: ${{ inputs.vs-path }} - toolset: ${{ inputs.compiler-toolset-version }} - name: Fetch Environment Info id: env-info @@ -89,4 +89,4 @@ runs: esac echo "COMPILER_FULL_VERSION=$COMPILER_FULL_VERSION" echo "compiler-full-version=$COMPILER_FULL_VERSION" >> "$GITHUB_OUTPUT" - echo "deps-cache-key=deps4-${{ inputs.os-name }}-${{ inputs.os-version }}-${{ inputs.compiler-toolset }}-${COMPILER_FULL_VERSION}-${{ inputs.cpp-version-name }}-${{ inputs.build-type-name }}" >> "$GITHUB_OUTPUT" + echo "deps-cache-key=deps5-${{ inputs.os-name }}-${{ inputs.os-version }}-${{ inputs.compiler-toolset }}-${COMPILER_FULL_VERSION}-${{ inputs.cpp-version-name }}-${{ inputs.build-type-name }}" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 852fbc5..edc34d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,14 +36,16 @@ on: required: false type: string default: "" - compiler-toolset-version: + msvc-toolset-prefix: required: false type: string default: "" - vs-path: + description: 'Version prefix of the MSVC toolset; the newest installed match is used (e.g. "14.5")' + msvc-platform-toolset: required: false type: string default: "" + description: 'Visual Studio platform toolset passed to CMake -T (e.g. "v145")' cmake-config-additional-args: required: false type: string @@ -86,8 +88,7 @@ jobs: compiler-toolset: ${{ inputs.compiler-toolset }} compiler-version: ${{ inputs.compiler-version }} compiler-executable: ${{ inputs.compiler-executable }} - compiler-toolset-version: ${{ inputs.compiler-toolset-version }} - vs-path: ${{ inputs.vs-path }} + msvc-toolset-prefix: ${{ inputs.msvc-toolset-prefix }} cpp-version-name: ${{ inputs.cpp-version-name }} build-type-name: ${{ inputs.build-type-name }} @@ -118,6 +119,7 @@ jobs: set -xe cmake ${{ steps.deps-info.outputs.IRIS_CI_CMAKE_ARGS }} -B build \ ${{ inputs.cmake-config-additional-args }} \ + ${{ inputs.compiler-toolset == 'msvc' && format('-T {0},version={1}', inputs.msvc-platform-toolset, steps.setup.outputs.msvc-toolset) || '' }} \ -DCMAKE_CXX_COMPILER=${{ inputs.compiler-executable }} \ -DCMAKE_CXX_FLAGS="${{ inputs.compiler-cxxflags }}" \ -DCMAKE_CXX_STANDARD=${{ inputs.cpp-version-number }} \ @@ -172,6 +174,7 @@ jobs: compiler-toolset: ${{ inputs.compiler-toolset }} compiler-version: ${{ inputs.compiler-version }} compiler-executable: ${{ inputs.compiler-executable }} + msvc-toolset-prefix: ${{ inputs.msvc-toolset-prefix }} cpp-version-name: ${{ inputs.cpp-version-name }} build-type-name: ${{ inputs.build-type-name }} @@ -189,6 +192,7 @@ jobs: run: | set -xe cmake -DFETCHCONTENT_FULLY_DISCONNECTED=ON -B build \ + ${{ inputs.compiler-toolset == 'msvc' && format('-T {0},version={1}', inputs.msvc-platform-toolset, steps.setup.outputs.msvc-toolset) || '' }} \ -DCMAKE_CXX_COMPILER=${{ inputs.compiler-executable }} \ -DCMAKE_CXX_FLAGS="${{ inputs.compiler-cxxflags }}" \ -DCMAKE_CXX_STANDARD=${{ inputs.cpp-version-number }} \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b88376c..9a3728f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,8 +73,10 @@ jobs: - name: MSVC toolset: msvc version: 2026 - toolset_version: 14.51 - vs-path: C:\Program Files\Microsoft Visual Studio\18\Enterprise + # Runner images replace toolsets on update (e.g. 14.51 by 14.52), so + # use the newest installed one matching the prefix. + toolset_prefix: "14.5" + platform_toolset: v145 cmake_config_additional_args: -G "Visual Studio 18 2026" builder_additional_args: -- "-consoleLoggerParameters:ForceConsoleColor" executable: cl @@ -104,8 +106,8 @@ jobs: compiler-version: ${{ matrix.compiler.version }} compiler-executable: ${{ matrix.compiler.executable }} compiler-cxxflags: ${{ matrix.compiler.cxxflags }} - compiler-toolset-version: ${{ matrix.compiler.toolset_version }} - vs-path: ${{ matrix.compiler.vs-path }} + msvc-toolset-prefix: ${{ matrix.compiler.toolset_prefix }} + msvc-platform-toolset: ${{ matrix.compiler.platform_toolset }} cmake-config-additional-args: ${{ matrix.compiler.cmake_config_additional_args }} compiler-builder-additional-args: ${{ matrix.compiler.builder_additional_args }} components: ${{ needs.changes.outputs.components }} From f5acf42b88e2dad582aed6535950b356edb7369b Mon Sep 17 00:00:00 2001 From: yaito3014 Date: Thu, 19 Nov 2026 12:10:19 +0900 Subject: [PATCH 2/5] Fetch deps in the build job when the deps cache misses The build job always configured with FETCHCONTENT_FULLY_DISCONNECTED=ON, assuming prepare-deps had saved build/_deps under the same key. The key includes the MSVC version, and since the toolset is now selected per job, the two jobs can pick different ones when they land on different runner images during a rollout (14.51 vs 14.52 in PR #120's CI). The build job then missed the cache and configure failed under CMP0170. Set FETCHCONTENT_FULLY_DISCONNECTED only on a cache hit, as prepare-deps already does, so a miss costs a dependency build instead of failing. --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index edc34d3..3832f20 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -185,13 +185,16 @@ jobs: key: ${{ steps.setup.outputs.deps-cache-key }} path: ${{ github.workspace }}/build/_deps + # The cache can miss when this job lands on a runner image with another + # toolset than prepare-deps did (e.g. during an image rollout); fetch the + # dependencies again in that case. - name: Configure env: CLICOLOR_FORCE: 1 shell: bash run: | set -xe - cmake -DFETCHCONTENT_FULLY_DISCONNECTED=ON -B build \ + cmake ${{ steps.cache-deps.outputs.cache-hit == 'true' && '-DFETCHCONTENT_FULLY_DISCONNECTED=ON' || '' }} -B build \ ${{ inputs.compiler-toolset == 'msvc' && format('-T {0},version={1}', inputs.msvc-platform-toolset, steps.setup.outputs.msvc-toolset) || '' }} \ -DCMAKE_CXX_COMPILER=${{ inputs.compiler-executable }} \ -DCMAKE_CXX_FLAGS="${{ inputs.compiler-cxxflags }}" \ From c1829a20e65c0a3d94bcf21837170fd4668238b5 Mon Sep 17 00:00:00 2001 From: yaito3014 Date: Thu, 19 Nov 2026 12:19:46 +0900 Subject: [PATCH 3/5] Inline the cache-hit check in prepare-deps' configure step Decide on FETCHCONTENT_FULLY_DISCONNECTED with the same inline expression as the build job, instead of a separate step that exported it as IRIS_CI_CMAKE_ARGS, so both jobs read the same way. --- .github/workflows/build.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3832f20..413d913 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -101,23 +101,13 @@ jobs: # Adapt CMP0168; enable caching in CI # https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_FULLY_DISCONNECTED - - name: Setup Cached CMake Dependencies - id: deps-info - shell: bash - run: | - if [ "${{ steps.cache-deps.outputs.cache-hit }}" = "true" ]; then - echo "IRIS_CI_CMAKE_ARGS=-DFETCHCONTENT_FULLY_DISCONNECTED=ON" >> "$GITHUB_OUTPUT" - else - echo "IRIS_CI_CMAKE_ARGS=" >> "$GITHUB_OUTPUT" - fi - - name: Configure env: CLICOLOR_FORCE: 1 shell: bash run: | set -xe - cmake ${{ steps.deps-info.outputs.IRIS_CI_CMAKE_ARGS }} -B build \ + cmake ${{ steps.cache-deps.outputs.cache-hit == 'true' && '-DFETCHCONTENT_FULLY_DISCONNECTED=ON' || '' }} -B build \ ${{ inputs.cmake-config-additional-args }} \ ${{ inputs.compiler-toolset == 'msvc' && format('-T {0},version={1}', inputs.msvc-platform-toolset, steps.setup.outputs.msvc-toolset) || '' }} \ -DCMAKE_CXX_COMPILER=${{ inputs.compiler-executable }} \ From 62d64aad76246217d7e3ea664ad7cf721534e9b1 Mon Sep 17 00:00:00 2001 From: yaito3014 Date: Thu, 19 Nov 2026 12:26:21 +0900 Subject: [PATCH 4/5] Save the deps cache when the build job builds the deps itself On a deps cache miss the build job fetched and built Catch2 but never saved it, so later runs in the same PR rebuilt it whenever their job landed on that toolset again. Build Catch2WithMain in its own step and save build/_deps right after configure, as prepare-deps does, so the cache holds a complete deps build regardless of whether the tests then compile. The step is named "Prepare Deps" rather than "Build Deps" because cpp-warning-notifier links each result to the first successful step matching STEP_REGEX ("Build .+"), which must remain "Build Tests". --- .github/workflows/build.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 413d913..3a7f665 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -194,6 +194,22 @@ jobs: -DIRIS_CI=ON \ -S . + # Not named "Build ...": the warning notifier links to the first step + # matching its STEP_REGEX, which must be "Build Tests". + - name: Prepare Deps + if: steps.cache-deps.outputs.cache-hit != 'true' + env: + CLICOLOR_FORCE: 1 + run: | + cmake --build build --config ${{ inputs.build-type-name }} -j${{ env.IRIS_CI_BUILD_JOBS }} --target Catch2WithMain ${{ inputs.compiler-builder-additional-args }} + + - name: Cache CMake Dependencies (save) + if: steps.cache-deps.outputs.cache-hit != 'true' + uses: actions/cache/save@v5 + with: + key: ${{ steps.setup.outputs.deps-cache-key }} + path: ${{ github.workspace }}/build/_deps + - name: Build Tests env: CLICOLOR_FORCE: 1 From d7166b7936fd6cdd4334d2c8b6bea83cb7f858eb Mon Sep 17 00:00:00 2001 From: yaito3014 Date: Thu, 19 Nov 2026 12:57:05 +0900 Subject: [PATCH 5/5] Drop the step-name comment on Prepare Deps --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a7f665..f289583 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -194,8 +194,6 @@ jobs: -DIRIS_CI=ON \ -S . - # Not named "Build ...": the warning notifier links to the first step - # matching its STEP_REGEX, which must be "Build Tests". - name: Prepare Deps if: steps.cache-deps.outputs.cache-hit != 'true' env: