Adds basic CI through GitHub Actions #9
Workflow file for this run
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
name: CMake on multiple platforms | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- dev | |
pull_request: | |
branches: | |
- master | |
- main | |
- dev | |
env: | |
CLANG_TIDY_VERSION: "15.0.2" | |
jobs: | |
Test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows-latest | |
- ubuntu-latest | |
- macos-latest | |
compiler: | |
- llvm-15.0.2 | |
- gcc | |
generator: | |
- "Ninja Multi-Config" | |
build_type: | |
- Release | |
- Debug | |
include: | |
- os: "windows-latest" | |
compiler: "msvc" | |
steps: | |
- name: Check for LLVM version mismatches | |
if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }} | |
uses: actions/github-script@v3 | |
with: | |
script: | | |
core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen') | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/vcpkg | |
./build/vcpkg_installed | |
${{ env.HOME }}/.cache/vcpkg/archives | |
${{ env.XDG_CACHE_HOME }}/vcpkg/archives | |
${{ env.LOCALAPPDATA }}\vcpkg\archives | |
${{ env.APPDATA }}\vcpkg\archives | |
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}} | |
restore-keys: | | |
${{ runner.os }}-${{ env.BUILD_TYPE }}- | |
- name: Setup Cpp | |
uses: aminya/setup-cpp@v1 | |
with: | |
compiler: ${{ matrix.compiler }} | |
vcvarsall: ${{ contains(matrix.os, 'windows') }} | |
cmake: true | |
ninja: true | |
vcpkg: true | |
clangtidy: ${{ env.CLANG_TIDY_VERSION }} | |
cppcheck: true | |
- name: Configure CMake | |
run: | | |
cmake -S . --preset ${{matrix.os}}-${{matrix.compiler}}-${{matrix.build_type}} | |
- name: Build | |
run: | | |
cmake --build ${{matrix.os}}-${{matrix.compiler}}-${{matrix.build_type}} | |
- name: Test | |
working-directory: ./out/build/${{matrix.os}}-${{matrix.compiler}}-${{matrix.build_type}} | |
run: | | |
ctest |