Don't run slow/expensive CI jobs if faster jobs fail #1035
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: Build and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '30 2 * * 1' | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
include: | |
- os: windows-latest | |
vcpkg-cmake-file: "$env:VCPKG_INSTALLATION_ROOT\\scripts\\buildsystems\\vcpkg.cmake" | |
ctest-target: RUN_TESTS | |
- os: ubuntu-latest | |
vcpkg-cmake-file: "$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" | |
ctest-target: test | |
- os: macos-latest | |
vcpkg-cmake-file: "$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" | |
ctest-target: test | |
env: | |
CMAKE_BUILD_DIR: ${{ github.workspace }}/build | |
CMAKE_TEST_DIR: ${{ github.workspace }}/build/test | |
VCPKG_BINARY_SOURCES: files,${{ github.workspace }}/build/cache,readwrite | |
steps: | |
- uses: actions/checkout@v3 | |
- name: dependencies (macos) | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: | | |
brew install llvm pkg-config | |
ln -s "/usr/local/opt/llvm/bin/clang-format" "/usr/local/bin/clang-format" | |
ln -s "/usr/local/opt/llvm/bin/clang-tidy" "/usr/local/bin/clang-tidy" | |
- name: dependencies (ubuntu) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
apt-get install linux-headers-$(uname -r) | |
- name: Restore cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/build/cache | |
key: ${{ runner.os }} | |
- name: Configure to use clang-tidy and sanitizers | |
run: | | |
cmake -B "${{ env.CMAKE_BUILD_DIR }}" -DTESTING=ON -DCLANG_TIDY=ON -DSANITIZERS=ON -DCMAKE_TOOLCHAIN_FILE="${{ matrix.vcpkg-cmake-file}}" . | |
- name: Build | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --parallel 2 | |
- name: Unit tests | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target "${{ matrix.ctest-target}}" |