Nix unconditional fatal errors. (#12) #127
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: ci | |
on: | |
pull_request: | |
release: | |
types: [published] | |
push: | |
tags: '*' | |
branches: | |
- main | |
- develop | |
env: | |
VERBOSE: 1 | |
jobs: | |
build-and-test: | |
name: ${{matrix.name}} (${{matrix.cmake_build_type}}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
name: | |
- Linux GCC | |
- Linux Clang | |
- Linux Emscripten | |
- MacOS Clang | |
- MacOS GCC | |
- Windows MSVC | |
cmake_build_type: | |
- Debug | |
- Release | |
include: | |
- compiler: clang++ | |
- cmake-launcher: '' | |
- name: 'Linux GCC' | |
compiler: g++ | |
os: ubuntu-latest | |
- name: 'Linux Clang' | |
os: ubuntu-latest | |
- name: 'MacOS Clang' | |
os: macOS-latest | |
- name: 'MacOS GCC' | |
os: macOS-latest | |
compiler: g++-14 | |
- name: 'Windows MSVC' | |
compiler: cl | |
os: windows-latest | |
- name: 'Linux Emscripten' | |
compiler: '' | |
os: ubuntu-latest | |
cmake-launcher: emcmake | |
env: | |
compiler: ${{ matrix.compiler && format('-DCMAKE_CXX_COMPILER={0}', matrix.compiler) || '' }} | |
steps: | |
- name: Install cppcheck | |
run: ${{ runner.os == 'Windows' && 'choco install cppcheck -y' || runner.os == 'macOS' && 'brew install cppcheck' || runner.os == 'Linux' && 'sudo apt-get install cppcheck' }} | |
- name: Check for clang/clang-tidy version mismatches | |
if: ${{ matrix.compiler == 'clang++' }} | |
run: | | |
# Don't bother unless clang-tidy is available. | |
if ! clang-tidy --version > /dev/null 2>&1; then | |
exit 0 | |
fi | |
clang_version=$(clang --version | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') | |
clang_tidy_version=$(clang-tidy --version | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') | |
if [ "$clang_version" != "$clang_tidy_version" ]; then | |
echo "clang version $clang_version doesn't match clang-tidy version $clang_tidy_version" | |
exit 1 | |
fi | |
- name: Set up Emscripten | |
uses: mymindstorm/setup-emsdk@v14 | |
if: ${{ contains(matrix.name, 'Emscripten') }} | |
- name: Set up MSVC (Windows) | |
uses: compnerd/gha-setup-vsdevenv@main | |
- name: Set up latest CMake and Ninja | |
uses: lukka/get-cmake@latest | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Configure | |
run: | | |
${{ matrix.cmake-launcher }} cmake -Wno-dev -S . -B ./build -GNinja ${{env.compiler}} -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_CXX_STANDARD=17 | |
- name: Build | |
run: | | |
cmake --build ./build | |
- name: Test | |
run: | | |
ctest --output-on-failure --timeout 20 --test-dir ./build |