Repository navigation
173 lines (166 loc) · 5.71 KB
/
Copy pathquantlib-risks.yml
File metadata and controls
173 lines (166 loc) · 5.71 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# builds only on the following conditions:
# - pull requests into main that change what goes into the wheels (paths below)
# - OR pushes of tags starting with v*
# - OR manual dispatch on repo
# publishes to test pypi if:
# - in auto-differentiation/QuantLibAAD-Py repository AND
# - pushes of tags starting with v*
# - OR manual dispatch on repo
# publishes to real PyPI if:
# - publish to Test PyPI worked (with all build conditions above)
# - and if it's a version tag (starting with v*)
#
# cibuildwheel config: [tool.cibuildwheel] in pyproject.toml
name: QuantLibAAD wheels
on:
pull_request:
branches:
- main
# only changes that go into the wheels; examples and notebooks are tested in examples.yml
paths:
- ".github/workflows/quantlib-risks.yml"
- ".gitmodules"
- "CMakeLists.txt"
- "LICENSE.md"
- "pyproject.toml"
- "cmake/**"
- "lib/**"
- "patches/**"
- "tools/**"
- "SWIG/**"
- "Python/CMakeLists.txt"
- "Python/QuantLibAAD/**"
- "Python/README.md"
- "Python/test/**"
push:
tags:
- v*
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build_wheels:
name: Wheels ${{ matrix.platform.name }} ${{ matrix.python }}
strategy:
fail-fast: false
matrix:
python: [cp310, cp311, cp312, cp313, cp314]
platform:
- { name: manylinux-x86_64, os: ubuntu-24.04, build: "manylinux*" }
- { name: musllinux-x86_64, os: ubuntu-24.04, build: "musllinux*" }
- { name: manylinux-aarch64, os: ubuntu-24.04-arm, build: "manylinux*" }
- { name: musllinux-aarch64, os: ubuntu-24.04-arm, build: "musllinux*" }
- { name: macos-x86_64, os: macos-15-intel, build: "*" }
- { name: macos-arm64, os: macos-15, build: "*" }
- { name: windows-amd64, os: windows-2022, build: "*" }
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
persist-credentials: false
- name: Compiler cache setup
shell: bash
run: |
# outside the checkout, which is copied into the Linux build containers
echo "CCACHE_DIR=$RUNNER_TEMP/ccache" >> "$GITHUB_ENV"
echo "SCCACHE_DIR=$RUNNER_TEMP/sccache" >> "$GITHUB_ENV"
case "$RUNNER_OS" in
macOS)
echo "CMAKE_CXX_COMPILER_LAUNCHER=ccache" >> "$GITHUB_ENV" ;;
Windows)
# sccache needs Ninja (bundled with Visual Studio), not the VS generator
echo "CMAKE_GENERATOR=Ninja" >> "$GITHUB_ENV"
echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV" ;;
esac
- name: Compiler cache
uses: hendrikmuhs/ccache-action@v1.2.25
with:
key: ${{ matrix.platform.name }}
variant: ${{ runner.os == 'Windows' && 'sccache' || 'ccache' }}
max-size: 2G
- name: MSVC environment (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1.13.0
- name: Build wheels
uses: pypa/cibuildwheel@v4.3.5
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform.build }}
# Linux builds run in containers: ccache installed there, cache on the host (/host)
CIBW_BEFORE_ALL_LINUX: dnf install -y ccache git || apk add --no-cache ccache git
CIBW_INHERIT: "before-all-linux: prepend"
CIBW_ENVIRONMENT_LINUX: >-
CMAKE_CXX_COMPILER_LAUNCHER=ccache
CCACHE_DIR=/host${{ runner.temp }}/ccache/$AUDITWHEEL_PLAT
CCACHE_MAXSIZE=1G
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: dist-wheels-${{ matrix.platform.name }}-${{ matrix.python }}
path: ./wheelhouse/*.whl
if-no-files-found: error
build_sdist:
name: SDist
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
persist-credentials: false
- name: Build sdist
run: pipx run build --sdist
- name: Check metadata
run: pipx run twine check --strict dist/*
- name: Upload sdist
uses: actions/upload-artifact@v7
with:
name: dist-sdist
path: dist/*.tar.gz
if-no-files-found: error
test-publish:
needs: [build_wheels, build_sdist]
if: >-
github.repository == 'auto-differentiation/QuantLibAAD-Py' &&
(github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')))
environment:
name: testpypi
url: https://test.pypi.org/p/QuantLibAAD
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
pattern: dist-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@v1.14.3
name: Publish on Test PyPI
with:
verbose: true
repository-url: https://test.pypi.org/legacy/
skip-existing: true
publish:
runs-on: ubuntu-latest
needs: test-publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/p/QuantLibAAD
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
pattern: dist-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@v1.14.3
name: Publish on PyPI
with:
verbose: true
skip-existing: true