Skip to content

CI

CI #653

Workflow file for this run

# Workflow to run against the corresponding QuantLib release,
# testing if the build and tests are working fine
# Note: In addition to pushes/pull requests, this workflow
# can also be executed manually, and the repositories / branches
# for QuantLib and XAD can be provided in this case.
name: CI
on:
push:
pull_request:
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
schedule:
- cron: '02 5 * * *' # 5:02 every day
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:
xad-linux:
strategy:
fail-fast: false
matrix:
disable_aad: ["ON", "OFF"]
runs-on: ubuntu-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: QuantLib-Risks-Cpp
- name: Setup
run: |
sudo apt update
sudo apt install -y libboost-dev ccache ninja-build
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.12
with:
key: linux-${{ matrix.disable_aad }}
max-size: 650M
- name: Configure
run: |
rm -rf ${{ github.workspace }}/install
cd QuantLib
mkdir build
cd build
cmake -G Ninja -DBOOST_ROOT=/usr \
-DQLRISKS_DISABLE_AAD=${{ matrix.disable_aad }} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DQL_EXTERNAL_SUBDIRECTORIES="${{ github.workspace }}/xad;${{ github.workspace }}/QuantLib-Risks-Cpp" \
-DQL_EXTRA_LINK_LIBRARIES=QuantLib-Risks \
-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 QuantLib-Risks
if: ${{ matrix.disable_aad == 'OFF' }}
run: |
cd QuantLib/build
./QuantLib-Risks-Cpp/test-suite/quantlib-risks-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 QuantLib-Risks-Cpp/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(QuantLib-Risks REQUIRED)" >> CMakeLists.txt
echo "add_executable(AdjointSwapXAD AdjointSwapXAD.cpp)" >> CMakeLists.txt
echo "target_link_libraries(AdjointSwapXAD PRIVATE QuantLib::QuantLib)" >> CMakeLists.txt
mkdir build
cd build
cmake -G Ninja -DBOOST_ROOT=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/install \
..
cmake --build .
./AdjointSwapXAD
xad-win:
strategy:
fail-fast: false
matrix:
disable_aad: ["ON", "OFF"]
runs-on: windows-2022
env:
vsvarsall: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
steps:
- uses: actions/checkout@v3
with:
repository: ${{ env.ql_repo }}
ref: ${{ env.ql_branch }}
path: QuantLib
- uses: actions/checkout@v3
with:
repository: ${{ env.xad_repo }}
ref: ${{ env.xad_branch }}
path: xad
- uses: actions/checkout@v3
with:
path: QuantLib-Risks-Cpp
- name: sccache
uses: hendrikmuhs/ccache-action@v1.2.12
with:
key: windows-${{ 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.84.0/boost_1_84_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 -vcvars_ver=14.3
cmake .. -G Ninja -DQLRISKS_DISABLE_AAD=${{ matrix.disable_aad }} -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE=Release -DQL_EXTERNAL_SUBDIRECTORIES="${{ github.workspace }}/xad;${{ github.workspace }}/QuantLib-Risks-Cpp" -DQL_EXTRA_LINK_LIBRARIES=QuantLib-Risks -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 -vcvars_ver=14.3
cmake --build .
- name: Test QuantLib
shell: cmd
run: |
cd QuantLib\build
call "${{ env.vsvarsall }}" amd64 -vcvars_ver=14.3
.\test-suite\quantlib-test-suite --log_level=message
- name: Test QuantLib-Risks
if: ${{ matrix.disable_aad == 'OFF' }}
shell: cmd
run: |
cd QuantLib\build
call "${{ env.vsvarsall }}" amd64 -vcvars_ver=14.3
.\QuantLib-Risks-Cpp\test-suite\quantlib-risks-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 QuantLib-Risks-Cpp\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(QuantLib-Risks 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
mkdir build
cd build
call "${{ env.vsvarsall }}" amd64 -vcvars_ver=14.3
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install ..
cmake --build .
AdjointSwapXAD.exe
xad-macos:
strategy:
fail-fast: false
matrix:
disable_aad: ["ON", "OFF"]
runs-on: macos-13
env:
CXXFLAGS: -stdlib=libc++ -mmacosx-version-min=10.9
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: QuantLib-Risks-Cpp
- name: Setup
run: |
brew install boost
brew install ninja
brew install ccache
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.12
with:
key: macos-${{ matrix.disable_aad }}
max-size: 650M
- name: Configure
run: |
cd QuantLib
mkdir build
cd build
cmake -G Ninja -DBOOST_ROOT=/usr \
-DQLRISKS_DISABLE_AAD=${{ matrix.disable_aad }} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DQL_EXTERNAL_SUBDIRECTORIES="${{ github.workspace }}/xad;${{ github.workspace }}/QuantLib-Risks-Cpp" \
-DQL_EXTRA_LINK_LIBRARIES=QuantLib-Risks \
-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 QuantLib-Risks
if: ${{ matrix.disable_aad == 'OFF' }}
run: |
cd QuantLib/build
./QuantLib-Risks-Cpp/test-suite/quantlib-risks-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 QuantLib-Risks-Cpp/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(QuantLib-Risks REQUIRED)" >> CMakeLists.txt
echo "add_executable(AdjointSwapXAD AdjointSwapXAD.cpp)" >> CMakeLists.txt
echo "target_link_libraries(AdjointSwapXAD PRIVATE QuantLib::QuantLib)" >> CMakeLists.txt
mkdir build
cd build
cmake -G Ninja -DBOOST_ROOT=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/install \
..
cmake --build .
./AdjointSwapXAD
xad-linux-std-classes:
runs-on: ubuntu-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: QuantLib-Risks-Cpp
- name: Setup
run: |
sudo apt update
sudo apt install -y libboost-dev ccache ninja-build
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.12
with:
key: linux-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="${{ github.workspace }}/xad;${{ github.workspace }}/QuantLib-Risks-Cpp" -DQL_EXTRA_LINK_LIBRARIES=QuantLib-Risks -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 QuantLib-Risks
run: |
cd QuantLib/build
./QuantLib-Risks-Cpp/test-suite/quantlib-risks-test-suite --log_level=message