Skip to content

Commit 7791300

Browse files
authored
CI: re-add MSBuild as a separate job, use matrix for ninja builds (#1130)
1 parent b17470d commit 7791300

File tree

1 file changed

+52
-21
lines changed

1 file changed

+52
-21
lines changed

.github/workflows/ci.yml

+52-21
Original file line numberDiff line numberDiff line change
@@ -350,57 +350,88 @@ jobs:
350350
working-directory: ./build
351351
run: ctest --output-on-failure
352352

353-
windows-msvc:
354-
name: 'Windows (Visual Studio)'
353+
windows-msvc-msbuild:
354+
name: Windows (MSVC MSBuild)
355+
runs-on: windows-2022
356+
steps:
357+
- name: 'Check Out'
358+
uses: actions/checkout@v4
359+
360+
# ccache not supported for this generator and/or Debug
361+
362+
- name: 'Build'
363+
shell: cmd
364+
run: |
365+
md build
366+
cd build
367+
cmake --version
368+
cmake ^
369+
-G "Visual Studio 17 2022" ^
370+
-D CMAKE_BUILD_TYPE=Debug ^
371+
-D CMAKE_CXX_STANDARD=17 ^
372+
-D BUILD_SHARED_LIBS=ON ^
373+
..
374+
IF %ERRORLEVEL% NEQ 0 exit /B 1
375+
cmake --build . --config Debug -j 4 -- /p:CL_MPcount=4
376+
377+
- name: 'Test'
378+
working-directory: build
379+
run: ctest --output-on-failure -C Debug
380+
381+
windows-msvc-ninja:
382+
name: Windows (MSVC Ninja)
355383
strategy:
356384
fail-fast: false
357385
matrix:
358386
ci:
359-
- build_type: Debug
360-
cxxstd: 14
361-
os: windows-2022
362-
vcdir: C:\Program Files\Microsoft Visual Studio\2022\Enterprise
387+
- os: windows-2019
388+
cxxstd: 14
389+
arch: x86
363390

364-
- build_type: Release
365-
cxxstd: 14
366-
os: windows-2019
367-
vcdir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
391+
- os: windows-2022
392+
cxxstd: 20
393+
arch: x64
368394

369395
runs-on: ${{ matrix.ci.os }}
370396
steps:
397+
371398
- name: 'Check Out'
372399
uses: actions/checkout@v4
373400

374-
- name: 'Setup'
375-
run: choco install ccache ninja
376-
377401
- name: Retrieve build cache
378402
id: restore-cache
379403
uses: actions/cache/restore@v4
380404
with:
381405
path: .ccache
382-
key: windows-msvc-${{ matrix.ci.os}}-${{ matrix.ci.build_type}}-${{ github.ref_name }}-${{ github.run_id }}
383-
restore-keys: windows-msvc-${{ matrix.ci.os}}-${{ matrix.ci.build_type}}
406+
key: msvc-ninja-${{ matrix.ci.os }}-${{ matrix.ci.cxxstd }}-${{ matrix.ci.arch }}-${{ github.ref_name }}-${{ github.run_id }}
407+
restore-keys: msvc-ninja-${{ matrix.ci.os }}-${{ matrix.ci.cxxstd }}-${{ matrix.ci.arch }}
408+
409+
- name: 'Setup'
410+
run: choco install ccache ninja
411+
412+
- name: Activate MSVC
413+
uses: ilammy/msvc-dev-cmd@v1
414+
with:
415+
arch: ${{ matrix.ci.arch }}
384416

385417
- name: 'Build'
386418
env:
387419
CCACHE_DIR: ${{ github.workspace }}\.ccache
388420
shell: cmd
389421
run: |
390-
call "${{ matrix.ci.vcdir }}\VC\Auxiliary\Build\vcvars64.bat"
391422
md build
392423
cd build
393424
cmake --version
394425
cmake ^
395426
-G Ninja ^
396-
-D CMAKE_BUILD_TYPE=${{ matrix.ci.build_type }} ^
427+
-D CMAKE_BUILD_TYPE=Release ^
397428
-D CMAKE_CXX_STANDARD=${{ matrix.ci.cxxstd }} ^
398429
-D BUILD_SHARED_LIBS=ON ^
399430
-D USE_CCACHE=ON ^
400431
..
401-
IF %ERRORLEVEL% NEQ 0 exit
402-
cmake --build . --config ${{ matrix.ci.build_type }} -j 4
403-
IF %ERRORLEVEL% NEQ 0 exit
432+
IF %ERRORLEVEL% NEQ 0 exit /B 1
433+
cmake --build . --config Release -j 4
434+
IF %ERRORLEVEL% NEQ 0 exit /B 1
404435
ccache --show-stats --verbose
405436
406437
- name: Save build cache
@@ -411,7 +442,7 @@ jobs:
411442

412443
- name: 'Test'
413444
working-directory: build
414-
run: ctest --output-on-failure -C ${{ matrix.ci.build_type }}
445+
run: ctest --output-on-failure -C Release
415446

416447
macos:
417448
name: 'macOS clang'

0 commit comments

Comments
 (0)