Update code base to pass clang-tidy (#552) #497
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: | |
generate-matrix: | |
name: Generate job matrix | |
runs-on: ubuntu-22.04 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/[email protected] | |
- 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_OUTPUT | |
builds: | |
# installed tools and runners can be found here: https://github.com/actions/runner-images | |
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/[email protected] | |
- name: Install dependencies // macOS | |
if: ${{ startsWith(matrix.config.os, 'macos') }} | |
run: | | |
brew update | |
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 // Linux (GCC|Clang) | |
if: ${{ startsWith(matrix.config.os, 'ubuntu') && !startsWith(matrix.config.compiler, 'emscripten') }} | |
run: | | |
sudo apt-get update | |
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 | |
vcpkg install boost-test:x64-windows boost-multiprecision:x64-windows | |
# vcpkg install boost:x64-windows | |
# dotnet add package boost --version 1.85.0 | |
# choco install --yes boost-msvc-14.3 | |
shell: cmd | |
- name: Install dependencies // Linux Emscripten | |
if: ${{ startsWith(matrix.config.compiler, 'emscripten') }} | |
shell: bash | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ninja-build | |
git clone --depth 1 --recurse-submodules --shallow-submodules --jobs=8 https://github.com/boostorg/boost.git $HOME/boost | |
git clone --depth 1 https://github.com/emscripten-core/emsdk.git $HOME/emsdk | |
pushd $HOME/emsdk | |
./emsdk install latest | |
./emsdk activate latest | |
echo 'source "$HOME/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile | |
# Override Emsdk's bundled node (14.18.2) to the GH Actions system installation (>= 16.16.0) | |
sed -i "/^NODE_JS = .*/c\NODE_JS = '`which node`'" .emscripten | |
echo "Overwrote .emscripten config file to:" | |
cat .emscripten | |
popd | |
- 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: Compile Boost // Emscripten | |
if: ${{ startsWith(matrix.config.compiler, 'emscripten') }} | |
shell: bash -l {0} | |
run: | | |
mkdir -p ../build-boost | |
cmake -S $HOME/boost -B ../build-boost -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 \ | |
-DCMAKE_CXX_FLAGS="-Wno-deprecated-builtins" \ | |
-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/cmake/Platform/Emscripten-STLab.cmake \ | |
-DBOOST_INCLUDE_LIBRARIES="multiprecision;test" | |
cmake --build ../build-boost | |
cmake --install ../build-boost | |
- name: Configure // Unix !Emscripten | |
if: ${{ (startsWith(matrix.config.os, 'ubuntu') || startsWith(matrix.config.os, 'macos')) && !startsWith(matrix.config.compiler, 'emscripten') }} | |
shell: bash | |
run: | | |
mkdir ../build | |
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=20 | |
- name: Configure // Linux Emscripten | |
if: ${{ startsWith(matrix.config.compiler, 'emscripten') }} | |
shell: bash -l {0} | |
run: | | |
mkdir ../build | |
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 \ | |
-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/cmake/Platform/Emscripten-STLab.cmake | |
- 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=Debug -DCMAKE_CXX_STANDARD=20 -DBoost_USE_STATIC_LIBS=TRUE -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake | |
- 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 |