An omnibus of improvements #208
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 Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
# Information on the runner matrix can be found in the `matrix.json` file. To find available | |
# versions of compilers, check https://github.com/actions/runner-images/. | |
generate-matrix: | |
name: Generate job matrix | |
runs-on: ubuntu-22.04 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate job matrix | |
id: set-matrix | |
# Note: The json in this variable must be a single line for parsing to succeed. | |
# run: echo "matrix=$(cat .github/matrix.json | scripts/flatten_json.py)" >> $GITHUB_STATE | |
run: echo "::set-output name=matrix::$(cat .github/matrix.json | scripts/flatten_json.py)" | |
builds: | |
needs: generate-matrix | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}} | |
name: ${{ matrix.config.name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies (macos) | |
if: ${{ startsWith(matrix.config.os, 'macos') }} | |
run: | | |
rm '/usr/local/bin/2to3' | |
rm '/usr/local/bin/2to3-3.12' | |
rm '/usr/local/bin/idle3' | |
rm '/usr/local/bin/idle3.12' | |
rm '/usr/local/bin/pydoc3' | |
rm '/usr/local/bin/pydoc3.12' | |
rm '/usr/local/bin/python3' | |
rm '/usr/local/bin/python3.12' | |
rm '/usr/local/bin/python3-config' | |
rm '/usr/local/bin/python3.12-config' | |
brew install boost | |
brew install ninja | |
shell: bash | |
- name: Install dependencies (ubuntu) | |
if: ${{ startsWith(matrix.config.os, 'ubuntu') }} | |
run: | | |
sudo apt-get install -y ninja-build | |
sudo apt-get install -y libboost-all-dev | |
shell: bash | |
- name: Install dependencies (Windows) | |
if: ${{ startsWith(matrix.config.os, 'windows') }} | |
run: | | |
choco install --yes ninja | |
shell: cmd | |
- name: Set enviroment variables (Linux+GCC) | |
if: ${{ matrix.config.compiler == 'gcc' }} | |
shell: bash | |
run: | | |
echo "CC=gcc-${{matrix.config.version}}" >> $GITHUB_ENV | |
echo "CXX=g++-${{matrix.config.version}}" >> $GITHUB_ENV | |
- name: Set enviroment variables (Linux+Clang) | |
if: ${{ matrix.config.compiler == 'clang' }} | |
shell: bash | |
run: | | |
echo "CC=clang-${{matrix.config.version}}" >> $GITHUB_ENV | |
echo "CXX=clang++-${{matrix.config.version}}" >> $GITHUB_ENV | |
# - name: Set enviroment variables (MacOS) | |
# if: ${{ matrix.config.compiler == 'apple-clang' }} | |
# shell: bash | |
# run: | | |
# echo "CC=$(brew --prefix llvm@13)/bin/clang" >> $GITHUB_ENV | |
# echo "CXX=$(brew --prefix llvm@13)/bin/clang++" >> $GITHUB_ENV | |
- name: Configure (Ubuntu) | |
if: ${{ startsWith(matrix.config.os, 'ubuntu') }} | |
shell: bash | |
run: | | |
mkdir ../build | |
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=${{matrix.config.cxxstd}} | |
- name: Configure (MacOS) | |
if: ${{ startsWith(matrix.config.os, 'macos') }} | |
shell: bash | |
run: | | |
mkdir ../build | |
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=${{matrix.config.cxxstd}} | |
- name: Configure (Windows) | |
if: ${{ startsWith(matrix.config.os, 'windows') }} | |
shell: cmd | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 | |
mkdir ..\build | |
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=${{matrix.config.cxxstd}} | |
- name: Build (Unix) | |
if: ${{ startsWith(matrix.config.os, 'ubuntu') || startsWith(matrix.config.os, 'macos') }} | |
shell: bash | |
run: | | |
cmake --build ../build/ | |
- name: Build (Windows) | |
if: ${{ startsWith(matrix.config.os, 'windows') }} | |
shell: cmd | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 | |
cmake --build ../build/ | |
- name: Test | |
shell: bash | |
run: | | |
cd ../build/ | |
ctest --output-on-failure |