Fixes #651 #69
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: BuildAndTest | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
jobs: | |
build-test: | |
strategy: | |
matrix: | |
platform: [ "ubuntu-latest", "macos-latest", "windows-latest" ] | |
build-type: [ "Release", "Debug" ] | |
# Extra cmake flags. GitHub Actions matrix overloads `include` to mean | |
# 'add extra things to a job' and 'add jobs'. You can add extra things | |
# to a job by specifying things that exist in a job created from the | |
# matrix definition and adding things. You can specify extra jobs by | |
# specifying properties that don't match existing jobs. We use | |
# `cmake-flags` to add cmake flags to all jobs matching a pattern and | |
# `extra-cmake-flags` to specify a new job with custom CMake flags. | |
extra-cmake-flags: [ "" ] | |
include: | |
- platform: "ubuntu-latest" | |
cmake-flags: "-G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang" | |
dependencies: "sudo apt install ninja-build" | |
- platform: "ubuntu-latest" | |
variant: "GCC" | |
cmake-flags: "-G Ninja" | |
dependencies: "sudo apt install ninja-build" | |
- platform: "ubuntu-latest" | |
variant: "asan" | |
build-type: "Release" | |
cmake-flags: "-G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang" | |
extra-cmake-flags: "-DVERONA_SANITIZER=address" | |
dependencies: "sudo apt install ninja-build" | |
- platform: "ubuntu-latest" | |
variant: "ubsan" | |
build-type: "Debug" | |
cmake-flags: "-G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang" | |
extra-cmake-flags: "-DVERONA_SANITIZER=undefined" | |
dependencies: "sudo apt install ninja-build" | |
fail-fast: false | |
runs-on: ${{matrix.platform}} | |
name: ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.variant }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: mjp41/workaround8649@c8550b715ccdc17f89c8d5c28d7a48eeff9c94a8 | |
with: | |
os: ${{ matrix.platform }} | |
- name: Install build dependencies | |
run: ${{ matrix.dependencies }} | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{matrix.cmake-flags}} ${{matrix.extra-cmake-flags}} | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build-type}} --target install | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: ctest -C ${{matrix.build-type}} --output-on-failure --timeout 400 --interactive-debug-mode 0 | |
# Job to run clang-format and report errors | |
format: | |
runs-on: ubuntu-22.04 | |
# We don't need to do the build for this job, but we need to configure it to get the clang-format target | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install clang-tidy and clang-format | |
run: | | |
sudo apt update | |
sudo apt install clang-tidy-15 clang-format-15 | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build | |
# Run the clang-format check and error if it generates a diff | |
- name: Run clang-format | |
working-directory: ${{github.workspace}}/build | |
run: | | |
set -eo pipefail | |
make clangformat | |
git diff --exit-code | |
all-checks: | |
needs: [format, build-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dummy step | |
run: true |