Bring in Ruiz scaling implementation #17
This file contains hidden or 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: CI | |
| # Note: manual dispatch enabled via `workflow_dispatch` trigger | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build and test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| build_type: [Debug, Release] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies (Linux) and modern CMake | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential ca-certificates wget | |
| CMAKE_VERSION=4.4.0 | |
| echo "Installing CMake ${CMAKE_VERSION}" | |
| wget -qO /tmp/cmake.tar.gz "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz" | |
| sudo tar -xzf /tmp/cmake.tar.gz -C /opt | |
| sudo ln -sfn /opt/cmake-${CMAKE_VERSION}-linux-x86_64/bin/* /usr/local/bin/ | |
| cmake --version | |
| - name: Install pinned CMake (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $CMAKE_VERSION = "4.4.0" | |
| Write-Host "Installing CMake $CMAKE_VERSION" | |
| $url = "https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-windows-x86_64.zip" | |
| Invoke-WebRequest -Uri $url -OutFile "$env:RUNNER_TEMP\cmake.zip" | |
| Expand-Archive -Path "$env:RUNNER_TEMP\cmake.zip" -DestinationPath "$env:RUNNER_TEMP\cmake" -Force | |
| $cmakeBin = "$env:RUNNER_TEMP\cmake\cmake-$CMAKE_VERSION-windows-x86_64\bin" | |
| # Prepend so it wins over the pre-installed CMake on the runner image. | |
| Add-Content -Path $env:GITHUB_PATH -Value $cmakeBin | |
| & "$cmakeBin\cmake.exe" --version | |
| - name: Configure | |
| run: | | |
| cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| - name: Build | |
| run: | | |
| cmake --build build --config ${{ matrix.build_type }} -- -m | |
| - name: Run tests | |
| run: | | |
| ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure -R "/quick" | |
| build_in_distros: | |
| name: Build in multiple Linux distros (container) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| image: ["ubuntu:22.04", "debian:12", "rockylinux:8", "fedora:40"] | |
| build_type: [Debug, Release] | |
| container: ${{ matrix.image }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Show distro | |
| run: cat /etc/os-release || true | |
| - name: Install build dependencies and modern CMake | |
| run: | | |
| set -e | |
| if command -v apt-get >/dev/null 2>&1; then | |
| apt-get update | |
| DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential ca-certificates git wget | |
| elif command -v yum >/dev/null 2>&1; then | |
| yum -y install gcc gcc-c++ make wget git | |
| if ! command -v cmake >/dev/null 2>&1; then | |
| yum -y install epel-release || true | |
| yum -y install cmake3 || true | |
| if command -v cmake3 >/dev/null 2>&1; then | |
| ln -s $(command -v cmake3) /usr/local/bin/cmake || true | |
| fi | |
| fi | |
| else | |
| echo "Unknown package manager; please install build tools in the container image" >&2 | |
| exit 1 | |
| fi | |
| CMAKE_VERSION=3.26.4 | |
| echo "Installing CMake ${CMAKE_VERSION}" | |
| wget -qO /tmp/cmake.tar.gz "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz" | |
| tar -xzf /tmp/cmake.tar.gz -C /tmp | |
| ln -sfn /tmp/cmake-${CMAKE_VERSION}-linux-x86_64/bin/* /usr/local/bin/ || true | |
| cmake --version || true | |
| - name: Configure | |
| run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| - name: Build | |
| run: cmake --build build --config ${{ matrix.build_type }} -- -m | |
| - name: Run tests | |
| run: ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure -R "/quick" | |
| docs: | |
| name: Build documentation | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Doxygen | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y doxygen graphviz texlive-font-utils | |
| - name: Build docs | |
| run: | | |
| doxygen docs/Doxyfile | |
| - name: Validate generated docs | |
| run: | | |
| if [ ! -f docs/html/index.html ]; then | |
| echo "Documentation build failed: docs/html/index.html not found" | |
| exit 1 | |
| fi | |
| coverage: | |
| name: Coverage | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install coverage dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential ca-certificates wget python3-pip | |
| python3 -m pip install --user gcovr | |
| echo "${HOME}/.local/bin" >> $GITHUB_PATH | |
| - name: Configure coverage build | |
| run: | | |
| cmake -S . -B build-coverage -DENABLE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug | |
| - name: Build coverage build | |
| run: | | |
| cmake --build build-coverage --config Debug -- -m | |
| - name: Run tests for coverage | |
| run: | | |
| ctest --test-dir build-coverage -C Debug --output-on-failure -R "/quick" | |
| - name: Generate coverage report | |
| run: | | |
| gcovr -r . --filter library/ build-coverage --html-details -o coverage-report.html | |
| gcovr -r . --filter library/ build-coverage --txt -o coverage-summary.txt | |
| - name: Upload coverage artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: | | |
| coverage-report.html | |
| coverage-summary.txt |