CI #1482
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
| ############################################################################## | |
| # | |
| # QuantLibAAD CI Workflow | |
| # | |
| # Tests QuantLibAAD with XAD automatic differentiation, and optionally | |
| # | |
| # | |
| # Jobs: | |
| # - xad-linux: XAD tests (C++17, C++20, AAD ON/OFF) | |
| # - xad-win: XAD tests (C++17, C++20, AAD ON/OFF) | |
| # - xad-macos: XAD tests (C++17, C++20, AAD ON/OFF) | |
| # - xad-linux-std-classes: XAD with QL_USE_STD_CLASSES | |
| # | |
| # Copyright (C) 2010-2026 Xcelerit Computing Limited | |
| # | |
| # SPDX-License-Identifier: AGPL-3.0-or-later | |
| # | |
| ############################################################################## | |
| name: CI | |
| on: | |
| repository_dispatch: | |
| types: [xad-ci-trigger] | |
| push: | |
| pull_request: | |
| schedule: | |
| - cron: '02 5 * * *' # 5:02 every day | |
| workflow_dispatch: | |
| inputs: | |
| ql_repo: | |
| description: QuantLib repository in <owner>/<repo> format | |
| required: true | |
| default: lballabio/QuantLib | |
| ql_branch: | |
| description: Branch or tag for QuantLib repository | |
| required: true | |
| default: master | |
| xad_repo: | |
| description: XAD repository in <owner>/<repo> format | |
| required: true | |
| default: auto-differentiation/xad | |
| xad_branch: | |
| description: Branch or tag for XAD repository | |
| required: true | |
| default: main | |
| env: | |
| ql_repo: ${{ github.event.inputs.ql_repo || 'lballabio/QuantLib' }} | |
| ql_branch: ${{ github.event.inputs.ql_branch || 'master' }} | |
| xad_repo: ${{ github.event.inputs.xad_repo || 'auto-differentiation/xad' }} | |
| xad_branch: ${{ github.event.inputs.xad_branch || 'main' }} | |
| jobs: | |
| ############################################################################## | |
| # Linux - XAD | |
| # | |
| # Note on disable_aad naming: This uses the original QuantLibAAD | |
| # convention where QLAAD_DISABLE_AAD=OFF means AAD is ENABLED (not disabled). | |
| # The confusing double-negative is preserved for compatibility. | |
| ############################################################################## | |
| xad-linux: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| disable_aad: ["ON", "OFF"] | |
| cxx: ["17", "20"] | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/lballabio/quantlib-devenv:rolling | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.ql_repo }} | |
| ref: ${{ env.ql_branch }} | |
| path: QuantLib | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.xad_repo }} | |
| ref: ${{ env.xad_branch }} | |
| path: xad | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: QuantLibAAD | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2.12 | |
| with: | |
| key: linux-xad-${{ matrix.cxx }}-${{ matrix.disable_aad }} | |
| max-size: 650M | |
| - name: Setup | |
| run: | | |
| apt-get update && apt install -y ccache ninja-build | |
| - name: Configure | |
| run: | | |
| rm -rf ${{ github.workspace }}/install | |
| cd QuantLib | |
| mkdir build | |
| cd build | |
| cmake -G Ninja -DBOOST_ROOT=/usr \ | |
| -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} \ | |
| -DQLAAD_DISABLE_AAD=${{ matrix.disable_aad }} \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DQL_EXTERNAL_SUBDIRECTORIES="$(pwd)/../../xad;$(pwd)/../../QuantLibAAD" \ | |
| -DQL_EXTRA_LINK_LIBRARIES=QuantLibAAD \ | |
| -DQL_NULL_AS_FUNCTIONS=ON \ | |
| -DCMAKE_INSTALL_PREFIX=$(pwd)/../../install \ | |
| .. | |
| - name: Compile | |
| run: | | |
| cd QuantLib/build | |
| cmake --build . | |
| - name: Test QuantLib | |
| run: | | |
| cd QuantLib/build | |
| ./test-suite/quantlib-test-suite --log_level=message | |
| - name: Test QuantLibAAD | |
| if: ${{ matrix.disable_aad == 'OFF' }} | |
| run: | | |
| cd QuantLib/build | |
| ./QuantLibAAD/test-suite/quantlib-aad-test-suite --log_level=message | |
| - name: Install | |
| if: ${{ matrix.disable_aad == 'OFF' }} | |
| run: | | |
| cd QuantLib/build | |
| cmake --install . | |
| - name: Test Install | |
| if: ${{ matrix.disable_aad == 'OFF' }} | |
| run: | | |
| mkdir installtest | |
| cp QuantLibAAD/Examples/AdjointSwap/AdjointSwapXAD.cpp installtest | |
| cd installtest | |
| echo "cmake_minimum_required(VERSION 3.15.2)" > CMakeLists.txt | |
| echo "project(QlTest LANGUAGES CXX)" >> CMakeLists.txt | |
| echo "find_package(QuantLibAAD REQUIRED)" >> CMakeLists.txt | |
| echo "add_executable(AdjointSwapXAD AdjointSwapXAD.cpp)" >> CMakeLists.txt | |
| echo "target_link_libraries(AdjointSwapXAD PRIVATE QuantLib::QuantLib)" >> CMakeLists.txt | |
| echo "target_compile_features(AdjointSwapXAD PUBLIC cxx_std_17)" >> CMakeLists.txt | |
| mkdir build | |
| cd build | |
| cmake -G Ninja -DBOOST_ROOT=/usr \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_PREFIX_PATH=$(pwd)/../../install \ | |
| .. | |
| cmake --build . | |
| ./AdjointSwapXAD | |
| ############################################################################## | |
| # Windows - XAD | |
| ############################################################################## | |
| xad-win: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| disable_aad: ["ON", "OFF"] | |
| cxx: ["17", "20"] | |
| runs-on: windows-2022 | |
| env: | |
| vsvarsall: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.ql_repo }} | |
| ref: ${{ env.ql_branch }} | |
| path: QuantLib | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.xad_repo }} | |
| ref: ${{ env.xad_branch }} | |
| path: xad | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: QuantLibAAD | |
| - name: sccache | |
| uses: hendrikmuhs/ccache-action@v1.2.12 | |
| with: | |
| key: windows-xad-${{ matrix.cxx }}-${{ matrix.disable_aad }} | |
| variant: sccache | |
| max-size: 650M | |
| - name: Setup | |
| run: | | |
| choco install -y ninja | |
| $Url = "https://downloads.sourceforge.net/project/boost/boost-binaries/1.86.0/boost_1_86_0-msvc-14.3-64.exe" | |
| (New-Object System.Net.WebClient).DownloadFile($Url, "$RUNNER_TEMP\boost.exe") | |
| Start-Process -Wait -FilePath "$RUNNER_TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=C:\local\boost" | |
| - name: Configure | |
| env: | |
| BOOST_ROOT: C:\local\boost | |
| shell: cmd | |
| run: | | |
| cd QuantLib | |
| mkdir build | |
| cd build | |
| call "${{ env.vsvarsall }}" amd64 | |
| cmake .. -G Ninja -DQLAAD_DISABLE_AAD=${{ matrix.disable_aad }} ^ | |
| -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} ^ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^ | |
| -DCMAKE_BUILD_TYPE=Release ^ | |
| -DQL_EXTERNAL_SUBDIRECTORIES="${{ github.workspace }}/xad;${{ github.workspace }}/QuantLibAAD" ^ | |
| -DQL_EXTRA_LINK_LIBRARIES=QuantLibAAD ^ | |
| -DQL_NULL_AS_FUNCTIONS=ON ^ | |
| -DXAD_STATIC_MSVC_RUNTIME=ON ^ | |
| -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install | |
| - name: Build | |
| shell: cmd | |
| run: | | |
| cd QuantLib\build | |
| call "${{ env.vsvarsall }}" amd64 | |
| cmake --build . | |
| - name: Test QuantLib | |
| shell: cmd | |
| run: | | |
| cd QuantLib\build | |
| call "${{ env.vsvarsall }}" amd64 | |
| .\test-suite\quantlib-test-suite --log_level=message | |
| - name: Test QuantLibAAD | |
| if: ${{ matrix.disable_aad == 'OFF' }} | |
| shell: cmd | |
| run: | | |
| cd QuantLib\build | |
| call "${{ env.vsvarsall }}" amd64 | |
| .\QuantLibAAD\test-suite\quantlib-aad-test-suite --log_level=message | |
| - name: Install | |
| if: ${{ matrix.disable_aad == 'OFF' }} | |
| run: | | |
| cd QuantLib/build | |
| cmake --install . | |
| - name: Test Install | |
| if: ${{ matrix.disable_aad == 'OFF' }} | |
| env: | |
| BOOST_ROOT: C:\local\boost | |
| shell: cmd | |
| run: | | |
| mkdir installtest | |
| copy QuantLibAAD\Examples\AdjointSwap\AdjointSwapXAD.cpp installtest | |
| cd installtest | |
| echo cmake_minimum_required(VERSION 3.15.2) > CMakeLists.txt | |
| echo project(QlTest LANGUAGES CXX) >> CMakeLists.txt | |
| echo find_package(QuantLibAAD REQUIRED) >> CMakeLists.txt | |
| echo add_executable(AdjointSwapXAD AdjointSwapXAD.cpp) >> CMakeLists.txt | |
| echo target_link_libraries(AdjointSwapXAD PRIVATE QuantLib::QuantLib) >> CMakeLists.txt | |
| echo set_target_properties(AdjointSwapXAD PROPERTIES MSVC_RUNTIME_LIBRARY MultiThreaded) >> CMakeLists.txt | |
| echo target_compile_features(AdjointSwapXAD PUBLIC cxx_std_17) >> CMakeLists.txt | |
| mkdir build | |
| cd build | |
| call "${{ env.vsvarsall }}" amd64 | |
| cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install .. | |
| cmake --build . | |
| AdjointSwapXAD.exe | |
| ############################################################################## | |
| # macOS - XAD | |
| ############################################################################## | |
| xad-macos: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| disable_aad: ["ON", "OFF"] | |
| cxx: ["17", "20"] | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.ql_repo }} | |
| ref: ${{ env.ql_branch }} | |
| path: QuantLib | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.xad_repo }} | |
| ref: ${{ env.xad_branch }} | |
| path: xad | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: QuantLibAAD | |
| - name: Setup | |
| run: | | |
| brew install boost ninja ccache | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2.12 | |
| with: | |
| key: macos-xad-${{ matrix.cxx }}-${{ matrix.disable_aad }} | |
| max-size: 650M | |
| - name: Configure | |
| run: | | |
| cd QuantLib | |
| mkdir build | |
| cd build | |
| cmake -G Ninja \ | |
| -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} \ | |
| -DQLAAD_DISABLE_AAD=${{ matrix.disable_aad }} \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DQL_EXTERNAL_SUBDIRECTORIES="${{ github.workspace }}/xad;${{ github.workspace }}/QuantLibAAD" \ | |
| -DQL_EXTRA_LINK_LIBRARIES=QuantLibAAD \ | |
| -DQL_NULL_AS_FUNCTIONS=ON \ | |
| -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install \ | |
| .. | |
| - name: Compile | |
| run: | | |
| cd QuantLib/build | |
| cmake --build . | |
| - name: Test QuantLib | |
| run: | | |
| cd QuantLib/build | |
| ./test-suite/quantlib-test-suite --log_level=message | |
| - name: Test QuantLibAAD | |
| if: ${{ matrix.disable_aad == 'OFF' }} | |
| run: | | |
| cd QuantLib/build | |
| ./QuantLibAAD/test-suite/quantlib-aad-test-suite --log_level=message | |
| - name: Install | |
| if: ${{ matrix.disable_aad == 'OFF' }} | |
| run: | | |
| cd QuantLib/build | |
| cmake --install . | |
| - name: Test Install | |
| if: ${{ matrix.disable_aad == 'OFF' }} | |
| run: | | |
| mkdir installtest | |
| cp QuantLibAAD/Examples/AdjointSwap/AdjointSwapXAD.cpp installtest | |
| cd installtest | |
| echo "cmake_minimum_required(VERSION 3.15.2)" > CMakeLists.txt | |
| echo "project(QlTest LANGUAGES CXX)" >> CMakeLists.txt | |
| echo "find_package(QuantLibAAD REQUIRED)" >> CMakeLists.txt | |
| echo "add_executable(AdjointSwapXAD AdjointSwapXAD.cpp)" >> CMakeLists.txt | |
| echo "target_link_libraries(AdjointSwapXAD PRIVATE QuantLib::QuantLib)" >> CMakeLists.txt | |
| echo "target_compile_features(AdjointSwapXAD PUBLIC cxx_std_17)" >> CMakeLists.txt | |
| mkdir build | |
| cd build | |
| cmake -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install \ | |
| .. | |
| cmake --build . | |
| ./AdjointSwapXAD | |
| ############################################################################## | |
| # Linux - XAD with QL_USE_STD_CLASSES | |
| ############################################################################## | |
| xad-linux-std-classes: | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/lballabio/quantlib-devenv:rolling | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.ql_repo }} | |
| ref: ${{ env.ql_branch }} | |
| path: QuantLib | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.xad_repo }} | |
| ref: ${{ env.xad_branch }} | |
| path: xad | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: QuantLibAAD | |
| - name: Setup | |
| run: | | |
| apt-get update && apt install -y ccache ninja-build | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2.12 | |
| with: | |
| key: linux-xad-std-classes | |
| max-size: 650M | |
| - name: Configure | |
| run: | | |
| cd QuantLib | |
| mkdir build | |
| cd build | |
| cmake -G Ninja -DBOOST_ROOT=/usr \ | |
| -DQL_USE_STD_CLASSES=ON \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DQL_EXTERNAL_SUBDIRECTORIES="$(pwd)/../../xad;$(pwd)/../../QuantLibAAD" \ | |
| -DQL_EXTRA_LINK_LIBRARIES=QuantLibAAD \ | |
| -DQL_NULL_AS_FUNCTIONS=ON \ | |
| .. | |
| - name: Compile | |
| run: | | |
| cd QuantLib/build | |
| cmake --build . | |
| - name: Test QuantLib | |
| run: | | |
| cd QuantLib/build | |
| ./test-suite/quantlib-test-suite --log_level=message | |
| - name: Test QuantLibAAD | |
| run: | | |
| cd QuantLib/build | |
| ./QuantLibAAD/test-suite/quantlib-aad-test-suite --log_level=message | |