generated from CoolLibs/library-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee613c5
commit 66c802c
Showing
1 changed file
with
74 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,226 +1,86 @@ | ||
name: Build and run tests | ||
|
||
on: | ||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
branches: [main] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
branches: [main] | ||
|
||
env: | ||
TARGET: reg-tests # Should be the name of the target you created in your CMakeLists.txt and want to build and run | ||
|
||
cmake_configure_args: -D WARNINGS_AS_ERRORS_FOR_REG=ON | ||
cmakelists_folder: tests | ||
cmake_target: reg-tests | ||
|
||
jobs: | ||
#----------------------------------------------------------------------------------------------- | ||
Windows_MSVC_Debug: | ||
name: Windows MSVC Debug | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Configure CMake | ||
run: cmake .\tests -B ${{github.workspace}}\build -DWARNINGS_AS_ERRORS_FOR_REG=ON -D CMAKE_C_COMPILER=cl -D CMAKE_CXX_COMPILER=cl | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}\build --config Debug --target ${{env.TARGET}} | ||
|
||
- name: Run | ||
run: ${{github.workspace}}\build\Debug\${{env.TARGET}} | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
Windows_MSVC_Release: | ||
name: Windows MSVC Release | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Configure CMake | ||
run: cmake .\tests -B ${{github.workspace}}\build -DWARNINGS_AS_ERRORS_FOR_REG=ON -D CMAKE_C_COMPILER=cl -D CMAKE_CXX_COMPILER=cl | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}\build --config Release --target ${{env.TARGET}} | ||
|
||
- name: Run | ||
run: ${{github.workspace}}\build\Release\${{env.TARGET}} | ||
#----------------------------------------------------------------------------------------------- | ||
Windows_Clang_Debug: | ||
name: Windows Clang Debug | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Configure CMake | ||
run: cmake .\tests -B ${{github.workspace}}\build -DWARNINGS_AS_ERRORS_FOR_REG=ON -T ClangCL | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}\build --config Debug --target ${{env.TARGET}} | ||
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: -D CMAKE_C_COMPILER=cl CMAKE_CXX_COMPILER=cl, | ||
} | ||
- { | ||
name: Windows Clang, | ||
os: windows-latest, | ||
cmake_configure_args: -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang, | ||
} | ||
- { | ||
name: Windows GCC, | ||
os: windows-latest, | ||
cmake_configure_args: -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++, | ||
} | ||
- { | ||
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 | ||
|
||
- name: Run | ||
run: ${{github.workspace}}\build\Debug\${{env.TARGET}} | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
Windows_Clang_Release: | ||
name: Windows Clang Release | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Configure CMake | ||
run: cmake .\tests -B ${{github.workspace}}\build -DWARNINGS_AS_ERRORS_FOR_REG=ON -T ClangCL | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}\build --config Release --target ${{env.TARGET}} | ||
|
||
- name: Run | ||
run: ${{github.workspace}}\build\Release\${{env.TARGET}} | ||
#----------------------------------------------------------------------------------------------- | ||
Linux_GCC_Debug: | ||
name: Linux GCC Debug | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Configure CMake | ||
run: cmake ./tests -B ${{github.workspace}}/build -DWARNINGS_AS_ERRORS_FOR_REG=ON -D CMAKE_BUILD_TYPE=Debug -D CMAKE_C_COMPILER=gcc-11 -D CMAKE_CXX_COMPILER=g++-11 | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}/build --config Debug --target ${{env.TARGET}} | ||
|
||
- name: Run | ||
run: ${{github.workspace}}/build/${{env.TARGET}} | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
Linux_GCC_Release: | ||
name: Linux GCC Release | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Configure CMake | ||
run: cmake ./tests -B ${{github.workspace}}/build -DWARNINGS_AS_ERRORS_FOR_REG=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=gcc-11 -D CMAKE_CXX_COMPILER=g++-11 | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}/build --config Release --target ${{env.TARGET}} | ||
|
||
- name: Run | ||
run: ${{github.workspace}}/build/${{env.TARGET}} | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
Linux_Clang_Debug: | ||
name: Linux Clang Debug | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Configure CMake | ||
run: cmake ./tests -B ${{github.workspace}}/build -DWARNINGS_AS_ERRORS_FOR_REG=ON -D CMAKE_BUILD_TYPE=Debug -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}/build --config Debug --target ${{env.TARGET}} | ||
|
||
- name: Run | ||
run: ${{github.workspace}}/build/${{env.TARGET}} | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
Linux_Clang_Release: | ||
name: Linux Clang Release | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Configure CMake | ||
run: cmake ./tests -B ${{github.workspace}}/build -DWARNINGS_AS_ERRORS_FOR_REG=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}/build --config Release --target ${{env.TARGET}} | ||
|
||
- name: Run | ||
run: ${{github.workspace}}/build/${{env.TARGET}} | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
MacOS_GCC_Debug: | ||
name: MacOS GCC Debug | ||
runs-on: macos-11 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Configure CMake | ||
run: cmake ./tests -B ${{github.workspace}}/build -DWARNINGS_AS_ERRORS_FOR_REG=ON -D CMAKE_BUILD_TYPE=Debug -D CMAKE_C_COMPILER=gcc-11 -D CMAKE_CXX_COMPILER=g++-11 | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}/build --config Debug --target ${{env.TARGET}} | ||
|
||
- name: Run | ||
run: ${{github.workspace}}/build/${{env.TARGET}} | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
MacOS_GCC_Release: | ||
name: MacOS GCC Release | ||
runs-on: macos-11 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Configure CMake | ||
run: cmake ./tests -B ${{github.workspace}}/build -DWARNINGS_AS_ERRORS_FOR_REG=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=gcc-11 -D CMAKE_CXX_COMPILER=g++-11 | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}/build --config Release --target ${{env.TARGET}} | ||
|
||
- name: Run | ||
run: ${{github.workspace}}/build/${{env.TARGET}} | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
MacOS_Clang_Debug: | ||
name: MacOS Clang Debug | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Configure CMake | ||
run: cmake ./tests -B ${{github.workspace}}/build -DWARNINGS_AS_ERRORS_FOR_REG=ON -D CMAKE_BUILD_TYPE=Debug -D CMAKE_C_COMPILER=$(brew --prefix llvm)/bin/clang -D CMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++ | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}/build --config Debug --target ${{env.TARGET}} | ||
|
||
- name: Run | ||
run: ${{github.workspace}}/build/${{env.TARGET}} | ||
|
||
#----------------------------------------------------------------------------------------------- | ||
MacOS_Clang_Release: | ||
name: MacOS Clang Release | ||
runs-on: macos-11 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Configure CMake | ||
run: cmake ./tests -B ${{github.workspace}}/build -DWARNINGS_AS_ERRORS_FOR_REG=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=$(brew --prefix llvm)/bin/clang -D CMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++ | ||
|
||
- name: Build | ||
run: cmake --build ${{github.workspace}}/build --config Release --target ${{env.TARGET}} | ||
|
||
- name: Run | ||
run: ${{github.workspace}}/build/${{env.TARGET}} | ||
- name: Set up MSVC # NOTE: required to find cl.exe and clang.exe when using the Ninja generator. And we need to use Ninja in order for ccache to be able to cache stuff on Windows. | ||
if: runner.os == 'Windows' && matrix.config.name != 'Windows GCC' | ||
uses: ilammy/msvc-dev-cmd@v1.13.0 | ||
|
||
- name: 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}} -G Ninja -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/${{env.cmake_target}} |