-
-
Notifications
You must be signed in to change notification settings - Fork 17
227 lines (210 loc) · 7.03 KB
/
ci.yaml
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: CI
on:
pull_request:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
env:
MATURIN_VERSION: 1.4.0
jobs:
test:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Install dev-requirements
run: pip install -r dev-requirements.txt
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Test
run: cargo test --release
- name: Test no numpy installed works
run: |
pip uninstall numpy -y
cargo test --release --features nonumpy
build:
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: test
strategy:
matrix:
python:
- version: '3.7'
- version: '3.8'
- version: '3.9'
- version: '3.10'
- version: '3.11'
- version: '3.12'
platform:
- os: ubuntu-latest
- os: macos-latest
- os: macos-latest
arch: aarch64
- os: windows-latest
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.constraints || matrix.python.version }}
# allow-prereleases: ${{ matrix.python.version == "3.12" }}
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.platform.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build Wheels - Linux
if: matrix.platform.os == 'ubuntu-latest'
uses: PyO3/maturin-action@v1
with:
maturin-version: ${{ env.MATURIN_VERSION }}
manylinux: auto
args: -i python${{ matrix.python.version }} --release --strip --sdist
- name: Check that the source distribution installed correctly
if: matrix.platform.os == 'ubuntu-latest'
run: pip install target/wheels/pyxirr-*.tar.gz
- name: Build Wheels - MacOS [aarch64]
if: ${{ matrix.platform.os == 'macos-latest' && matrix.platform.arch == 'aarch64' }}
uses: PyO3/maturin-action@v1
with:
maturin-version: ${{ env.MATURIN_VERSION }}
args: -i python --release --target aarch64-apple-darwin --strip
- name: Build Wheels - MacOS [x86_64]
if: ${{ matrix.platform.os == 'macos-latest' && matrix.platform.arch != 'aarch64' }}
uses: PyO3/maturin-action@v1
with:
maturin-version: ${{ env.MATURIN_VERSION }}
args: -i python --release --target universal2-apple-darwin --strip
- name: Build Wheels - Windows
if: matrix.platform.os == 'windows-latest'
uses: PyO3/maturin-action@v1
with:
maturin-version: ${{ env.MATURIN_VERSION }}
args: -i python --release --strip
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.platform.os }}-${{ matrix.platform.arch || 'x86_64' }}-${{ matrix.python.version }}
path: target/wheels
linux-cross:
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: test
strategy:
matrix:
python:
- version: '3.7'
abi: 'cp37-cp37m'
- version: '3.8'
abi: 'cp38-cp38'
- version: '3.9'
abi: 'cp39-cp39'
- version: '3.10'
abi: 'cp310-cp310'
- version: '3.11'
abi: 'cp311-cp311'
- version: '3.12'
abi: 'cp312-cp312'
target: [aarch64, armv7, s390x, ppc64le, ppc64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Wheels
uses: PyO3/maturin-action@v1
env:
PYO3_CROSS_LIB_DIR: /opt/python/${{ matrix.python.abi }}/lib
with:
maturin-version: ${{ env.MATURIN_VERSION }}
target: ${{ matrix.target }}
manylinux: auto
args: --release --strip -i python${{ matrix.python.version }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.target }}-${{ matrix.python.version }}
path: target/wheels
wasm-emscripten:
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: test
strategy:
matrix:
# https://pyodide.org/en/stable/project/changelog.html
version:
- python: '3.11'
emscripten: 3.1.46 # pyodide 0.25.*
- python: '3.11'
emscripten: 3.1.45 # pyodide 0.24.*
- python: '3.11'
emscripten: 3.1.32 # pyodide 0.23.*
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ matrix.version.emscripten }}
- uses: PyO3/maturin-action@v1
with:
maturin-version: ${{ env.MATURIN_VERSION }}
target: wasm32-unknown-emscripten
rust-toolchain: nightly
args: --release --strip -i python${{ matrix.version.python }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-wasm-emscripten-${{ matrix.version.emscripten }}
path: target/wheels
linux-musl:
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: test
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- i686-unknown-linux-musl
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabihf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Wheels - musl
uses: PyO3/maturin-action@v1
with:
maturin-version: ${{ env.MATURIN_VERSION }}
target: ${{ matrix.target }}
manylinux: musllinux_1_2
args: --release --strip -i 3.7 3.8 3.9 3.10 3.11 3.12
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musl-${{ matrix.target }}
path: target/wheels
publish:
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
- linux-cross
- linux-musl
- wasm-emscripten
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
- run: pip install maturin
- name: Release
uses: softprops/action-gh-release@v1
with:
files: pyxirr*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: PyPI publish
env:
MATURIN_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# wasm excluded because pypi doesn't support wasm wheels yet
run: find . -name 'pyxirr*' -not -name '*wasm*' | xargs -l maturin upload --skip-existing --username __token__