-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (112 loc) · 4.22 KB
/
windows.yml
File metadata and controls
126 lines (112 loc) · 4.22 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
116
117
118
119
120
121
122
123
124
125
126
# 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: Windows build
on:
workflow_dispatch:
push:
branches: [main]
paths:
- "src/**"
- "include/**"
- "CMakeLists.txt"
- "pyproject.toml"
- ".github/workflows/windows.yml"
pull_request:
paths:
- "src/**"
- "include/**"
- "CMakeLists.txt"
- "pyproject.toml"
- ".github/workflows/windows.yml"
env:
QUANTLIB_VERSION: "1.41"
BOOST_VERSION: "1.86.0"
BOOST_VERSION_UNDERSCORE: "1_86_0"
jobs:
build:
runs-on: windows-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: Cache Boost headers
id: cache-boost
uses: actions/cache@v4
with:
path: C:/boost
key: boost-headers-${{ env.BOOST_VERSION }}-windows-v1
- name: Download Boost headers
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
Write-Host "Downloading Boost $env:BOOST_VERSION headers..."
$url = "https://archives.boost.io/release/$env:BOOST_VERSION/source/boost_$env:BOOST_VERSION_UNDERSCORE.zip"
Invoke-WebRequest -Uri $url -OutFile boost.zip
Write-Host "Extracting Boost headers..."
Expand-Archive -Path boost.zip -DestinationPath C:/boost-temp
mkdir C:/boost/include -Force
Move-Item "C:/boost-temp/boost_$env:BOOST_VERSION_UNDERSCORE/boost" "C:/boost/include/boost"
Remove-Item -Recurse -Force C:/boost-temp, boost.zip
Write-Host "Boost headers installed to C:/boost/include"
- name: Cache QuantLib
id: cache-quantlib
uses: actions/cache@v4
with:
path: C:/quantlib-install
key: quantlib-${{ env.QUANTLIB_VERSION }}-std-windows-v3
restore-keys: |
quantlib-${{ env.QUANTLIB_VERSION }}-std-windows-
- name: Build QuantLib from source
if: steps.cache-quantlib.outputs.cache-hit != 'true'
run: |
Write-Host "Downloading QuantLib $env:QUANTLIB_VERSION..."
Invoke-WebRequest -Uri "https://github.com/lballabio/QuantLib/releases/download/v$env:QUANTLIB_VERSION/QuantLib-$env:QUANTLIB_VERSION.tar.gz" -OutFile QuantLib.tar.gz
tar xzf QuantLib.tar.gz
cd "QuantLib-$env:QUANTLIB_VERSION"
mkdir build -Force | Out-Null
cd build
Write-Host "Configuring QuantLib with std:: flags..."
cmake .. -G "Visual Studio 17 2022" -A x64 `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_INSTALL_PREFIX=C:/quantlib-install `
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL `
-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 `
-DBoost_INCLUDE_DIR=C:/boost/include
Write-Host "Building QuantLib..."
cmake --build . --config Release --parallel
Write-Host "Installing QuantLib..."
cmake --install . --config Release
- name: Verify QuantLib configuration
run: |
Write-Host "Checking QuantLib config.hpp for std:: flags..."
Get-Content "C:\quantlib-install\include\ql\config.hpp" | Select-String -Pattern "QL_USE_STD"
- 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: C:/quantlib-install
Boost_INCLUDE_DIR: C:/boost/include
- name: Run tests
run: |
pytest -v