Skip to content

Refactor CI workflow #492

Refactor CI workflow

Refactor CI workflow #492

Workflow file for this run

name: Build & Test
on:
push:
paths-ignore:
- 'doc/**'
branches: [ main ]
pull_request:
paths-ignore:
- 'doc/**'
branches: [ main ]
jobs:
# For linux runners
build-on-linux:
name: Linux -x- ${{ matrix.compiler }} -x- ${{ matrix.config }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config: [Debug, Release]
compiler: [g++-14, clang++-18]
steps:
- uses: actions/checkout@v2
- name: Install C++ compilers, and CMake
run: |
# https://github.com/actions/runner-images/issues/7192
echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates
sudo apt update && sudo apt-get -y upgrade --fix-missing
sudo apt-get install build-essential cmake
sudo apt-get install ${{ matrix.compiler }}
- name: Configure
run: >
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.config }}
- name: Build
run: cmake --build build --parallel --config ${{ matrix.config }}
- name: Test
run: ctest --test-dir build --output-on-failure
# For Windows runners
build-on-windows:
name: Windows -x- MSVC Preview -x- ${{ matrix.config }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
config: [Debug, Release]
steps:
- uses: actions/checkout@v4
- name: Accept winget source agreements
shell: pwsh
run: |
winget source reset --force
winget source update --accept-source-agreements
- name: Install MSVC Build Tools Preview
shell: pwsh
run: |
winget install --id Microsoft.VisualStudio.BuildTools `
--override "--quiet --wait --norestart `
--add Microsoft.VisualStudio.Workload.VCTools `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
--add Microsoft.VisualStudio.Component.Windows11SDK.26100 `
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
--includeRecommended" `
--accept-source-agreements --accept-package-agreements
- name: Set up MSVC environment
uses: ilammy/msvc-dev-cmd@v1
with:
vsversion: '18'
- name: Configure
shell: pwsh
run: >
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.config }}
- name: Build
shell: pwsh
run: cmake --build build --parallel --config ${{ matrix.config }}
- name: Test
shell: pwsh
run: ctest --test-dir build --output-on-failure