feat(build): Simplify some repetitive sections a bit #46
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: Basic compilation test for most common platforms | |
on: | |
push: | |
branches: [main] | |
paths: | |
- '.github/workflows/build-basic-test.yml' | |
- 'CMakeLists.txt' | |
- 'src/**' | |
pull_request: | |
branches: [main] | |
paths: | |
- '.github/workflows/build-basic-test.yml' | |
- 'CMakeLists.txt' | |
- 'src/**' | |
env: | |
BUILD_TYPE: RelWithDebInfo | |
jobs: | |
build: | |
name: Build on ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- name: 'Ubuntu 22.04 (oldest g++)' | |
os: ubuntu-22.04 | |
gccver: 9 | |
extraargs: '-DCMAKE_CXX_COMPILER=g++-9' | |
- name: 'Ubuntu 24.04 (newest g++)' | |
os: ubuntu-24.04 | |
gccver: 14 | |
extraargs: '-DCMAKE_CXX_COMPILER=g++-14' | |
- name: 'Windows Server 2019 (win32)' | |
os: windows-2019 | |
extraargs: '-DCMAKE_GENERATOR_PLATFORM=Win32' | |
- name: 'macOS 14 (x86_64-arm64 / newest Xcode)' | |
os: macos-14 | |
extraargs: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Install different g++ release (Ubuntu only)' | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get -qq update | |
sudo apt-get -qq install -o=Dpkg::Use-Pty=0 -y g++-${{ matrix.gccver }} | |
sudo apt-get clean | |
- name: 'Switch to newest available Xcode (macOS only)' | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
sudo xcode-select -s "$(ls -d /Applications/Xcode*.app | sort -V | tail -n 1)/Contents/Developer" | |
system_profiler SPDeveloperToolsDataType | |
- name: Print CMake version | |
run: cmake --version | |
- name: Configure for ${{env.BUILD_TYPE}} | |
run: cmake -S . -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{ matrix.extraargs }} | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build -j1 |