diff --git a/.github/workflows/build-test-windows.yml b/.github/workflows/build-test-windows.yml index f4b2356353bf..9f21cd7682e7 100644 --- a/.github/workflows/build-test-windows.yml +++ b/.github/workflows/build-test-windows.yml @@ -188,23 +188,19 @@ jobs: env: GETTEXT_ROOT: C:\msys64_meshlib_mrbind\clang64 VCPKG_ROOT: C:\vcpkg + # `|| exit /b 1` is used instead of `if errorlevel 1 exit 1` + # because the latter can miss exit codes inside parenthesized IF + # blocks in cmd.exe (e.g. it failed to catch a ninja build failure). run: | if ${{ fromJSON('["1==0", "1==1"]')[matrix.build_system == 'CMake'] }} ( - call "${{matrix.vc-path}}\Common7\Tools\VsDevCmd.bat" -arch=amd64 ${{ fromJSON('["", "-vcvars_ver=14.2"]')[matrix.cxx_compiler == 'msvc-2019'] }} - if errorlevel 1 exit 1 - cmake --version - if errorlevel 1 exit 1 - cmake -B source\TempOutput -GNinja -DCMAKE_BUILD_TYPE=${{matrix.config}} -DMESHLIB_BUILD_GENERATED_C_BINDINGS=${{ fromJSON('["OFF", "ON"]')[inputs.mrbind_c] }} - if errorlevel 1 exit 1 - cmake --build source\TempOutput -j - if errorlevel 1 exit 1 - if not exist source\x64 mkdir source\x64 - if errorlevel 1 exit 1 - xcopy source\TempOutput\bin\* source\x64\${{matrix.config}}\* /s /e /i /Y - if errorlevel 1 exit 1 + call "${{matrix.vc-path}}\Common7\Tools\VsDevCmd.bat" -arch=amd64 ${{ fromJSON('["", "-vcvars_ver=14.2"]')[matrix.cxx_compiler == 'msvc-2019'] }} || exit /b 1 + cmake --version || exit /b 1 + cmake -B source\TempOutput -GNinja -DCMAKE_BUILD_TYPE=${{matrix.config}} -DMESHLIB_BUILD_GENERATED_C_BINDINGS=${{ fromJSON('["OFF", "ON"]')[inputs.mrbind_c] }} || exit /b 1 + cmake --build source\TempOutput -j || exit /b 1 + if not exist source\x64 mkdir source\x64 || exit /b 1 + xcopy source\TempOutput\bin\* source\x64\${{matrix.config}}\* /s /e /i /Y || exit /b 1 ) else ( - msbuild -m source\MeshLib.sln -p:Configuration=${{ matrix.config }}${{ fromJSON('["", ";PlatformToolset=v142"]')[matrix.cxx_compiler == 'msvc-2019'] }} - if errorlevel 1 exit 1 + msbuild -m source\MeshLib.sln -p:Configuration=${{ matrix.config }}${{ fromJSON('["", ";PlatformToolset=v142"]')[matrix.cxx_compiler == 'msvc-2019'] }} || exit /b 1 ) - name: Generate and build Python bindings