Skip to content

MSVC 2022 (v14.3)

MSVC 2022 (v14.3) #691

Workflow file for this run

name: MSVC 2022 (v14.3)
on:
workflow_run:
workflows: [Generate single-include header]
types:
- completed
jobs:
msvc:
runs-on: windows-2022
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: true
matrix:
version: [14.3] # 2019(14.2), 2022(14.3)
modules: [false, true]
built_type: [Debug, Release]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
submodules: true # recursive
- name: Download Ninja
shell: cmake -P {0}
run: |
set(ninja_version "1.11.1") # needed for module support
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-win.zip")
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ./ninja.zip)
execute_process(COMMAND chmod +x ninja)
- name: Configure
shell: cmake -P {0}
run: |
set(ENV{CC} "cl.exe")
set(ENV{CXX} "cl.exe")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/ninja.exe" ninja_program)
execute_process(
COMMAND "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat" -vcvars_ver=${{ matrix.version }} && set
OUTPUT_FILE environment_script_output.txt
)
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
execute_process(
COMMAND cmake
-S .
-B build
-G Ninja
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }}
-D ECS_COMPILE_AS_MODULE=${{ matrix.modules }}
-D CMAKE_MAKE_PROGRAM=${ninja_program}
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %e sec] ")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
execute_process(
COMMAND cmake --build build
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Run tests
shell: cmake -P {0}
run: |
include(ProcessorCount)
ProcessorCount(N)
execute_process(
COMMAND ctest --output-on-failure -j ${N}
WORKING_DIRECTORY build
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Running tests failed!")
endif()