CMake build for the latest runners and C++ standards #28
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: CMake build for the latest runners and C++ standards | |
| on: | |
| schedule: | |
| # At 02:35 on Monday | |
| - cron: '35 2 * * 1' | |
| workflow_dispatch: | |
| jobs: | |
| cmake-build-and-test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| settings: | |
| [ | |
| { os: macos-latest, cc: clang, cxx: clang++ }, | |
| { os: ubuntu-latest, cc: clang, cxx: clang++ }, | |
| { os: ubuntu-latest, cc: gcc, cxx: g++ }, | |
| { os: windows-latest, cc: cl, cxx: cl } | |
| ##### This is the full set of currently available runners and compilers. ##### | |
| # { os: macos-14, cc: clang, cxx: clang++ }, | |
| # { os: macos-15, cc: clang, cxx: clang++ }, | |
| # | |
| # { os: ubuntu-22.04, cc: clang-13, cxx: clang++-13 }, | |
| # { os: ubuntu-22.04, cc: clang-14, cxx: clang++-14 }, | |
| # { os: ubuntu-22.04, cc: clang-15, cxx: clang++-15 }, | |
| # | |
| # { os: ubuntu-22.04, cc: gcc-10, cxx: g++-10 }, | |
| # { os: ubuntu-22.04, cc: gcc-11, cxx: g++-11 }, | |
| # { os: ubuntu-22.04, cc: gcc-12, cxx: g++-12 }, | |
| # | |
| # { os: ubuntu-24.04, cc: clang-16, cxx: clang++-16 }, | |
| # { os: ubuntu-24.04, cc: clang-17, cxx: clang++-17 }, | |
| # { os: ubuntu-24.04, cc: clang-18, cxx: clang++-18 }, | |
| # | |
| # { os: ubuntu-24.04, cc: gcc-12, cxx: g++-12 }, | |
| # { os: ubuntu-24.04, cc: gcc-13, cxx: g++-13 }, | |
| # { os: ubuntu-24.04, cc: gcc-14, cxx: g++-14 }, | |
| # | |
| # { os: windows-2022, cc: cl, cxx: cl }, | |
| # { os: windows-2025, cc: cl, cxx: cl } | |
| ] | |
| cxx-standard: [ 17, 20, 23 ] | |
| cmake-build-type: [ release ] | |
| runs-on: ${{ matrix.settings.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Determine ccache variant | |
| shell: bash | |
| run: | | |
| echo "CMAKE_CXX_COMPILER_LAUNCHER=${{ ( (runner.os == 'Windows') && 'sccache' ) || 'ccache' }}" >> $GITHUB_ENV | |
| - name: Setup CCache | |
| uses: hendrikmuhs/[email protected] | |
| with: | |
| key: cmake-latest-${{ inputs.os }}-${{ inputs.cxx }}-${{ inputs.cxx-standard }} | |
| restore-keys: | | |
| cmake-latest-${{ inputs.os }}-${{ inputs.cxx }}-${{ inputs.cxx-standard }} | |
| cmake-latest-${{ inputs.os }}-${{ inputs.cxx }} | |
| cmake-latest-${{ inputs.os }} | |
| variant: ${{ env.CMAKE_CXX_COMPILER_LAUNCHER }} | |
| - name: Setup Linux | |
| if: runner.os == 'Linux' | |
| shell: bash | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ccache ninja-build | |
| eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
| brew update | |
| brew install boost | |
| echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH | |
| - name: Setup macOS | |
| if: runner.os == 'macOS' | |
| shell: bash | |
| run: | | |
| HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install ninja boost | |
| echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV | |
| - name: Setup Windows | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $BoostUri = "https://archives.boost.io/release/1.90.0/binaries/boost_1_90_0-msvc-14.3-64.exe" | |
| Start-BitsTransfer -Source $BoostUri -Destination $env:RUNNER_TEMP\boost.exe | |
| Start-Process -Wait -FilePath "$env:RUNNER_TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=$env:RUNNER_TEMP\boost" | |
| choco install -y ninja | |
| Write "Boost_DIR=$env:RUNNER_TEMP\boost\lib64-msvc-14.3\cmake\Boost-1.90.0" >> $env:GITHUB_ENV | |
| - name: Set up Visual Studio shell on Windows | |
| if: runner.os == 'Windows' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x64 | |
| - name: Configure CMake and build | |
| env: | |
| CC: ${{ matrix.settings.cc }} | |
| CXX: ${{ matrix.settings.cxx }} | |
| run: | | |
| cmake --version | |
| cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} -DQL_COMPILE_WARNING_AS_ERROR=ON -L | |
| cmake --build build --verbose | |
| - name: Run the test-suite | |
| run: | | |
| ./build/test-suite/quantlib-test-suite -l message |