Skip to content

🔨⚗️ [CI] Experiments #72

🔨⚗️ [CI] Experiments

🔨⚗️ [CI] Experiments #72

name: Build and run tests
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
cmake_configure_args: -D WARNINGS_AS_ERRORS_FOR_EXE_PATH=ON
cmakelists_folder: tests
cmake_target: exe_path-tests
jobs:
build-and-run-tests:
name: ${{matrix.config.name}} ${{matrix.build_type}}
runs-on: ${{matrix.config.os}}
strategy:
fail-fast: false
matrix:
config:
- {
name: Windows MSVC,
os: windows-latest,
cmake_configure_args: -G "Ninja",
}
# - {
# name: Windows Clang,
# os: windows-latest,
# cmake_configure_args: -T ClangCL -G "Ninja",
# }
# - {
# name: Windows GCC,
# os: windows-latest,
# cmake_configure_args: -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ -G Ninja,
# }
# - {
# name: Linux Clang,
# os: ubuntu-latest,
# cmake_configure_args: -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++,
# }
# - {
# name: Linux GCC,
# os: ubuntu-latest,
# cmake_configure_args: -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++,
# }
# - {
# name: MacOS Clang,
# os: macos-latest,
# cmake_configure_args: -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++,
# }
# - {
# name: MacOS GCC,
# os: macos-latest,
# cmake_configure_args: -D CMAKE_C_COMPILER=gcc-13 -D CMAKE_CXX_COMPILER=g++-13,
# }
build_type:
- Debug
- Release
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@main
- name: Set up ccache
uses: hendrikmuhs/ccache-action@main
with:
key: ${{matrix.config.name}}-${{matrix.build_type}}
- name: Build
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: ${{github.workspace}}/${{env.cmakelists_folder}}/CMakeLists.txt
cmakeAppendedArgs: ${{env.cmake_configure_args}} -D CMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.config.cmake_configure_args}} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
buildWithCMakeArgs: --config ${{matrix.build_type}} --target ${{env.cmake_target}}
cmakeBuildType: ${{matrix.build_type}}
buildDirectory: ${{github.workspace}}/build
- name: Run
run: ${{github.workspace}}/build/${{(runner.os == 'Windows' && matrix.config.name != 'Windows GCC') && matrix.build_type || ''}}/${{env.cmake_target}}