-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (101 loc) · 3.54 KB
/
linux.yml
File metadata and controls
115 lines (101 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# PyQuantLib: Python bindings for QuantLib
# Copyright (c) 2025 Yassine Idyiahia
#
# QuantLib is Copyright (c) 2000-2025 The QuantLib Authors
# QuantLib is free software under a modified BSD license.
# See http://quantlib.org/ for more information.
#
# Source: https://github.com/quantales/pyquantlib
# Licensed under the BSD 3-Clause License. See LICENSE file for details.
name: Linux build
on:
workflow_dispatch:
push:
branches: [main]
paths:
- "src/**"
- "include/**"
- "CMakeLists.txt"
- "pyproject.toml"
- ".github/workflows/linux.yml"
pull_request:
paths:
- "src/**"
- "include/**"
- "CMakeLists.txt"
- "pyproject.toml"
- ".github/workflows/linux.yml"
env:
QUANTLIB_VERSION: "1.41"
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libboost-all-dev cmake ninja-build
- name: Cache QuantLib
id: cache-quantlib
uses: actions/cache@v4
with:
path: /home/runner/quantlib-install
key: quantlib-${{ env.QUANTLIB_VERSION }}-static-ubuntu-latest-v1
restore-keys: |
quantlib-${{ env.QUANTLIB_VERSION }}-static-ubuntu-latest-
- name: Build QuantLib from source
if: steps.cache-quantlib.outputs.cache-hit != 'true'
run: |
wget https://github.com/lballabio/QuantLib/releases/download/v${{ env.QUANTLIB_VERSION }}/QuantLib-${{ env.QUANTLIB_VERSION }}.tar.gz
tar xzf QuantLib-${{ env.QUANTLIB_VERSION }}.tar.gz
cd QuantLib-${{ env.QUANTLIB_VERSION }}
mkdir -p build && cd build
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/home/runner/quantlib-install \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DQL_USE_STD_SHARED_PTR=ON \
-DQL_USE_STD_OPTIONAL=ON \
-DQL_USE_STD_ANY=ON \
-DQL_BUILD_EXAMPLES=OFF \
-DQL_BUILD_TEST_SUITE=OFF \
-DQL_BUILD_BENCHMARK=OFF
ninja
ninja install
- name: Verify QuantLib configuration
run: |
echo "Checking QuantLib config.hpp for std:: flags..."
grep -E "QL_USE_STD_(SHARED_PTR|OPTIONAL|ANY)" /home/runner/quantlib-install/include/ql/config.hpp || echo "Flags not found in config.hpp"
- name: Install Python build dependencies
run: |
python -m pip install --upgrade pip
- name: Build package with dev dependencies
run: |
pip install -e .[dev] -v
env:
QuantLib_ROOT: /home/runner/quantlib-install
LD_LIBRARY_PATH: /home/runner/quantlib-install/lib
- name: Run tests with coverage
run: |
pytest --cov=pyquantlib --cov=tests --cov-report=xml --cov-report=term-missing
env:
LD_LIBRARY_PATH: /home/runner/quantlib-install/lib
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}