Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 55 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,101 +8,84 @@ on:
branches:
- main

jobs:
linux-min:
name: Linux Min Config
runs-on: ubuntu-22.04
strategy:
matrix:
compiler: [clang++-15, g++-12]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Dependencies
# Boost must be installed only because the CMake version (3.12) can't
# detect the installed Boost version (1.69)
run: sudo apt-get update && sudo apt-get -y install ninja-build libboost-date-time-dev g++-multilib
- name: Run tests with common Catch
run: |
cmake -G Ninja .
cmake --build . -- test_hello-world
cmake --build .
env:
CXX: ${{ matrix.compiler }}
# A new push to a PR cancels that PR's run still in progress.
# Runs on main are left to finish, so every commit there gets a full result.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

linux-latest:
name: Linux Latest Config
needs: [linux-min]
runs-on: ubuntu-26.04
jobs:
build:
# Setting the name from the matrix keeps the check names that
# .github/required-checks.yml lists, such as "Windows" and "MacOS".
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
# The configurations are one matrix so that the first failure cancels the rest.
fail-fast: true
matrix:
compiler: [clang++, g++]
include:
- name: Linux Min Config (clang++-15)
os: ubuntu-22.04
compiler: clang++-15
packages: ninja-build libboost-date-time-dev g++-multilib
cmake-args: -G Ninja
- name: Linux Min Config (g++-12)
os: ubuntu-22.04
compiler: g++-12
packages: ninja-build libboost-date-time-dev g++-multilib
cmake-args: -G Ninja
- name: Linux Latest Config (clang++)
os: ubuntu-26.04
compiler: clang++
packages: ninja-build libboost-date-time-dev
cmake-args: -G Ninja -DEXERCISM_COMMON_CATCH=OFF
- name: Linux Latest Config (g++)
os: ubuntu-26.04
compiler: g++
packages: ninja-build libboost-date-time-dev
cmake-args: -G Ninja
- name: Windows
os: windows-2022
- name: MacOS
os: macOS-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Dependencies
if: runner.os == 'Linux'
# Boost must be installed only because the CMake version (3.12) can't
# detect the installed Boost version (1.69)
run: sudo apt-get update && sudo apt-get -y install ninja-build libboost-date-time-dev
- name: Run tests with common Catch
if: matrix.compiler == 'g++'
run: |
cmake -G Ninja .
cmake --build . -- test_hello-world
cmake --build .
env:
CXX: ${{ matrix.compiler }}
- name: Run tests without common Catch
if: matrix.compiler == 'clang++'
run: |
cmake -G Ninja -DEXERCISM_COMMON_CATCH=OFF .
cmake --build . -- test_hello-world
cmake --build .
env:
CXX: ${{ matrix.compiler }}

windows:
name: Windows
needs: [linux-min]
runs-on: windows-2022
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Run Tests
run: sudo apt-get update && sudo apt-get -y install ${{ matrix.packages }}
- name: Install Boost
if: runner.os == 'macOS'
run: brew install boost
- name: Remove exercises that need Boost
if: runner.os == 'Windows'
shell: powershell
# Delete the exercises that require Boost to avoid issues with Windows setup.
run: |
rm exercises/practice/gigasecond -r
rm exercises/practice/meetup -r
cmake .
cmake --build . -- test_hello-world
cmake --build .

mac:
name: MacOS
needs: [linux-min]
runs-on: macOS-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Boost
run: brew install boost
- name: Run Tests
- name: Run tests
shell: bash
run: |
cmake .
cmake --build . -- test_hello-world
cmake --build .
cmake ${{ matrix.cmake-args }} .
cmake --build . --target test_hello-world
cmake --build . --parallel
env:
CXX: ${{ matrix.compiler }}

tests:
name: Tests
needs: [linux-min, linux-latest, windows, mac]
needs: [build]
if: always()
runs-on: ubuntu-26.04
steps:
- name: Check that every configuration passed
env:
LINUX_MIN_RESULT: ${{ needs.linux-min.result }}
LINUX_LATEST_RESULT: ${{ needs.linux-latest.result }}
WINDOWS_RESULT: ${{ needs.windows.result }}
MAC_RESULT: ${{ needs.mac.result }}
BUILD_RESULT: ${{ needs.build.result }}
run: |
if [[ "$LINUX_MIN_RESULT" != "success" || "$LINUX_LATEST_RESULT" != "success" || "$WINDOWS_RESULT" != "success" || "$MAC_RESULT" != "success" ]]; then
if [[ "$BUILD_RESULT" != "success" ]]; then
echo "The exercise tests failed on at least one configuration."
exit 1
fi
Loading