Skip to content

Huge experimental refactor. #597

Huge experimental refactor.

Huge experimental refactor. #597

Workflow file for this run

name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
run_tests:
strategy:
matrix:
build_type: [ Release, Debug ]
# Only Windows builds are enabled, because preinstalled CLang and GCC version on both ubuntu-latest and
# macos-latest images do not fully support transparent unordered_multiset operations and concepts library.
os: [ windows-2022, ubuntu-22.04 ]
# Native toolchain is native compiler for the platform: MSVC for Windows and GCC for Ubuntu.
toolchain: [ CLang, Native ]
include:
# As of March 2022, there is a strange problem with llvm coverage on clang-cl 13.0 from VS 2022:
# llvm-profdata emits 'unsupported instrumentation profile format version' error for profraw's, emitted
# by programs, compiled using same clang-cl package.
# Therefore, we are using separate VS 2019 build to check coverage.
- build_type: Debug
os: windows-2019
toolchain: CLang
# Adding to compensate the exclusion below.
- build_type: Release
os: windows-2019
toolchain: CLang
exclude:
# As of June 2023, there is a strange issue with compiling on CLang on VS 2022: either build scripts are
# generated incorrectly or there is a strange problem with CLang on CI that cannot be reproduced locally.
# Therefore, we're temporary disabling builds on CLang on VS 2022 in favor of VS 2019.
- build_type: Debug
os: windows-2022
toolchain: CLang
- build_type: Release
os: windows-2022
toolchain: CLang
defaults:
run:
shell: pwsh
env:
BUILD_DIRECTORY: ${{github.workspace}}/Build
runs-on: ${{matrix.os}}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup dependencies
# Currently, things that use PhysX aren't supported on Ubuntu.
if: matrix.os != 'ubuntu-22.04'
uses: ./.github/actions/SetupDependencies
with:
platform: ${{runner.os}}
build_type: ${{matrix.build_type}}
- name: Install Ninja
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get update && sudo apt-get install ninja-build
- name: Install OpenGL
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get update && sudo apt-get install libgl1-mesa-dev
- name: Create build directory
run: cmake -E make_directory ${{env.BUILD_DIRECTORY}}
# We have separate build for coverage check, therefore we have separate configuration step for it here.
# On Windows images there is a separate LLVM installation that is already in Env:Path.
# We want to use CLangCL for coverage, therefore we must delete this installation from path to avoid mismatches.
- name: Configure coverage check
if: matrix.build_type == 'Debug' && matrix.os == 'windows-2019' && matrix.toolchain == 'CLang'
run: |
echo "ENABLE_COVERAGE=yes" >> $Env:GITHUB_ENV
echo "CMAKE_ENABLE_COVERAGE=-DEMERGENCE_ENABLE_COVERAGE=ON" >> $Env:GITHUB_ENV
echo "CMAKE_FALLBACK_TO_CXX20=-DEMERGENCE_FALLBACK_TO_CXX_20=ON" >> $Env:GITHUB_ENV
echo "CMAKE_DISABLE_DIRECTX=-DSDL_DIRECTX=OFF" >> $Env:GITHUB_ENV
echo "LLVM_PROFILE_FILE=%m.profraw" >> $Env:GITHUB_ENV
echo "CMAKE_GENERATOR=-G `"Visual Studio 16 2019`" -A x64 -T clangcl" >> $Env:GITHUB_ENV
$PathWithoutLLVM13 = $Env:Path.Replace("C:\Program Files\LLVM\bin", "")
echo "PATH=$PathWithoutLLVM13" >> $Env:GITHUB_ENV
# We disable DirectX here as SDL with it doesn't compile on VS 2019 CLang for some reason (only on CI).
- name: Windows - VS 2019 - Select CLang toolset
if: matrix.build_type == 'Release' && matrix.os == 'windows-2019' && matrix.toolchain == 'CLang'
run: |
echo "CMAKE_FALLBACK_TO_CXX20=-DEMERGENCE_FALLBACK_TO_CXX_20=ON" >> $Env:GITHUB_ENV
echo "CMAKE_GENERATOR=-G `"Visual Studio 16 2019`" -A x64 -T clangcl" >> $Env:GITHUB_ENV
echo "CMAKE_DISABLE_DIRECTX=-DSDL_DIRECTX=OFF" >> $Env:GITHUB_ENV
- name: Windows - Select CLang toolset
if: matrix.os == 'windows-2022' && matrix.toolchain == 'CLang'
run: echo "CMAKE_GENERATOR=-G `"Visual Studio 17 2022`" -A x64 -T clangcl" >> $Env:GITHUB_ENV
- name: Windows - Select MSVC 143 toolset
if: matrix.os == 'windows-2022' && matrix.toolchain == 'Native'
run: echo "CMAKE_GENERATOR=-G `"Visual Studio 17 2022`" -A x64 -T v143" >> $Env:GITHUB_ENV
- name: Ubuntu - Select GCC 11 toolset
if: matrix.os == 'ubuntu-22.04' && matrix.toolchain == 'Native'
run: |
echo "CC=gcc" >> $Env:GITHUB_ENV
echo "CXX=g++" >> $Env:GITHUB_ENV
echo "CMAKE_GENERATOR=-G `"Ninja Multi-Config`"" >> $Env:GITHUB_ENV
echo "CMAKE_FALLBACK_TO_CXX20=-DEMERGENCE_FALLBACK_TO_CXX_20=ON" >> $Env:GITHUB_ENV
- name: Ubuntu - Select CLang 14 toolset
if: matrix.os == 'ubuntu-22.04' && matrix.toolchain == 'CLang'
run: |
echo "CC=clang-14" >> $Env:GITHUB_ENV
echo "CXX=clang-14" >> $Env:GITHUB_ENV
echo "CMAKE_GENERATOR=-G `"Ninja Multi-Config`"" >> $Env:GITHUB_ENV
echo "CMAKE_FALLBACK_TO_CXX20=-DEMERGENCE_FALLBACK_TO_CXX_20=ON" >> $Env:GITHUB_ENV
- name: Configure
working-directory: ${{env.BUILD_DIRECTORY}}
run: >
cmake ${{github.workspace}} ${{env.CMAKE_GENERATOR}} ${{env.CMAKE_ENABLE_COVERAGE}}
${{env.CMAKE_FALLBACK_TO_CXX20}} ${{env.CMAKE_DISABLE_DIRECTX}} -DEMERGENCE_INCLUDE_GPU_DEPENDANT_TESTS=OFF
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
- name: Build
working-directory: ${{env.BUILD_DIRECTORY}}
run: cmake --build . --target EmergenceTests --config ${{matrix.build_type}} -j 2
- name: Test
working-directory: ${{env.BUILD_DIRECTORY}}
run: ctest -C ${{matrix.build_type}}
- name: Collect and check coverage data
if: env.ENABLE_COVERAGE == 'yes'
# We use CMD instead of PowerShell because of convenient && operator.
shell: cmd
run: >
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" &&
powershell .\Script\Coverage\CollectCLangCoverage.ps1 ${{env.BUILD_DIRECTORY}} ${{matrix.build_type}} &&
powershell .\Script\Coverage\CheckCLangCoverage.ps1 ${{env.BUILD_DIRECTORY}}
- name: Upload test and coverage results
if: env.ENABLE_COVERAGE == 'yes' && (${{ success() }} || ${{ failure() }})
uses: actions/upload-artifact@v2
with:
name: Test and coverage results (${{matrix.build_type}}, ${{matrix.os}}, ${{matrix.toolchain}})
path: |
${{env.BUILD_DIRECTORY}}/Coverage/Temporary
${{env.BUILD_DIRECTORY}}/Testing/Temporary