ci: Windows to use Ninja Multi-Config generator
diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index f4a8f66..c43ecd4 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml
@@ -130,8 +130,11 @@ strategy: matrix: arch: [ Win32, x64 ] - config: [ Debug, Release ] os: [ windows-latest ] + env: + # Exercises the multi-config generator path (Visual Studio, Xcode, Ninja Multi-Config), + # where switching Debug/Release/RelWithDebInfo must work from a single configure. + CMAKE_GENERATOR: Ninja Multi-Config steps: - uses: actions/checkout@v7 @@ -150,13 +153,12 @@ ${{ github.workspace }}/external/Vulkan-Headers/build/install ${{ github.workspace }}/external/googletest/build/install ${{ github.workspace }}/external/Vulkan-Loader/build/install - key: windows-dependencies-${{ matrix.config }}-${{ matrix.arch }}-${{ matrix.os }}-${{ hashfiles('scripts/known_good.json') }} + key: windows-dependencies-multi-config-${{ matrix.arch }}-${{ matrix.os }}-${{ hashfiles('scripts/known_good.json') }} - - name: Configure + - name: Configure (once, for every --config used below) run: | cmake -S. -B build ` -G "Ninja" ` - -D CMAKE_BUILD_TYPE=${{matrix.config}} ` -D UPDATE_DEPS=ON ` -D INSTALL_ICD=ON ` -D BUILD_TESTS=ON ` @@ -164,11 +166,17 @@ -D UPDATE_DEPS_SKIP_EXISTING_INSTALL=ON ` -D UPDATE_DEPS_DIR=${{ github.workspace }}/external - - name: Build - run: cmake --build ./build - - - name: Install - run: cmake --install build/ --prefix build/install + - name: Build and install Debug, Release and RelWithDebInfo without reconfiguring + run: | + foreach ($config in "Debug", "Release", "RelWithDebInfo") { + # BUILD_WERROR's link_options(/WX) turns any link warning (e.g. LNK4098, mismatched + # Debug/Release runtimes) into a build failure, so a non-zero exit here already covers it. + cmake --build build --config $config + if ($LASTEXITCODE -ne 0) { + throw "cmake --build failed for config $config" + } + cmake --install build --config $config --prefix ${{ github.workspace }}/install/$config + } - name: Test working-directory: ./build @@ -184,7 +192,7 @@ ${{ github.workspace }}/external/Vulkan-Headers/build/install ${{ github.workspace }}/external/googletest/build/install ${{ github.workspace }}/external/Vulkan-Loader/build/install - key: windows-dependencies-${{ matrix.config }}-${{ matrix.arch }}-${{ matrix.os }}-${{ hashfiles('scripts/known_good.json') }} + key: windows-dependencies-multi-config-${{ matrix.arch }}-${{ matrix.os }}-${{ hashfiles('scripts/known_good.json') }} mac: # mac is 10x expensive to run on GitHub machines, so only run if we know something else fast/simple passed as well