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..f289583 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 }} @@ -100,24 +101,15 @@ 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 }} \ -DCMAKE_CXX_FLAGS="${{ inputs.compiler-cxxflags }}" \ -DCMAKE_CXX_STANDARD=${{ inputs.cpp-version-number }} \ @@ -172,6 +164,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 }} @@ -182,13 +175,17 @@ 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 }}" \ -DCMAKE_CXX_STANDARD=${{ inputs.cpp-version-number }} \ @@ -197,6 +194,20 @@ jobs: -DIRIS_CI=ON \ -S . + - 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 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 }}