Add an all-checks CI task (#144) #516
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: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
global-cmake-flags: -DTRIESTE_ENABLE_TESTING=1 | |
jobs: | |
build-test: | |
strategy: | |
matrix: | |
platform: [ "ubuntu-latest", "macos-latest", "windows-latest" ] | |
build-type: [ "Release", "Debug" ] | |
# Note: cmake-options is missing here on purpose to let it be overridden by includes | |
standard: [ "", "-DTRIESTE_USE_CXX17=ON" ] | |
compiler: [ "", "clang" ] | |
variant: [""] | |
include: | |
# ensures ubuntu-latest clang uses Ninja (modifies the matrix entry) | |
- platform: "ubuntu-latest" | |
compiler: "clang" | |
cmake-options: "-DCMAKE_CXX_COMPILER=clang++-15 -DCMAKE_C_COMPILER=clang-15 -DTRIESTE_BUILD_PARSER_TESTS=1" | |
generator: "-G Ninja" | |
dependencies: "sudo apt install ninja-build" | |
- platform: "windows-latest" | |
variant: "build-parser-tests" | |
build-type: "Release" | |
cmake-options: "-DTRIESTE_BUILD_PARSER_TESTS=1" | |
- platform: "macos-latest" | |
variant: "build-parser-tests" | |
build-type: "Release" | |
cmake-options: "-DTRIESTE_BUILD_PARSER_TESTS=1" | |
- platform: "ubuntu-latest" | |
variant: "asan" | |
build-type: "Release" | |
cmake-options: "-DCMAKE_CXX_COMPILER=clang++-15 -DCMAKE_C_COMPILER=clang-15 -DTRIESTE_SANITIZE=address -DTRIESTE_BUILD_PARSER_TESTS=1" | |
- platform: "ubuntu-latest" | |
variant: "ubsan" | |
build-type: "Release" | |
cmake-options: "-DCMAKE_CXX_COMPILER=clang++-15 -DCMAKE_C_COMPILER=clang-15 -DTRIESTE_SANITIZE=undefined -DTRIESTE_BUILD_PARSER_TESTS=1" | |
exclude: | |
# Mac is already using clang. | |
- platform: "macos-latest" | |
compiler: "clang" | |
# Windows is only using MSVC. | |
- platform: "windows-latest" | |
compiler: "clang" | |
# Don't abort runners if a single one fails | |
fail-fast: false | |
runs-on: ${{matrix.platform}} | |
name: ${{matrix.platform}} ${{matrix.build-type}} ${{matrix.standard}} ${{matrix.compiler}} ${{matrix.variant}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install build dependencies | |
run: ${{matrix.dependencies}} | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build ${{env.global-cmake-flags}} -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{matrix.generator}} ${{matrix.standard}} ${{matrix.cmake-options}} | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build-type}} | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
run: ctest -C ${{matrix.build-type}} --output-on-failure --timeout 400 --interactive-debug-mode 0 | |
all-checks: | |
# Join of all build-test jobs | |
needs: [build-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check all jobs | |
run: echo "All jobs passed" |