-
Notifications
You must be signed in to change notification settings - Fork 26
444 lines (428 loc) · 14.2 KB
/
pysplashsurf_CI.yml
File metadata and controls
444 lines (428 loc) · 14.2 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
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
name: Python bindings
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
release:
types: [published]
permissions:
contents: read
jobs:
check_format:
name: Check formatting of pySplashsurf crate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check formatting of pySplashsurf crate
run: cargo fmt -- --check
working-directory: pysplashsurf
generate-stub:
name: Run stub generator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: moonrepo/setup-rust@v1
- run: |
cargo run --bin stub_gen --no-default-features
working-directory: pysplashsurf
- name: Upload stub as artifact
uses: actions/upload-artifact@v4
with:
name: pysplashsurf.pyi
path: pysplashsurf/pysplashsurf/
# linux_wheels:
# name: Build wheels for "${{ matrix.python-version }}"
# needs: generate-stub
# runs-on: ubuntu-24.04
# strategy:
# fail-fast: false
# matrix:
# include:
# - python-version: "manylinux_x86_64"
# archs: "x86_64"
# enable_test: true
# - python-version: "manylinux_i686"
# archs: "i686"
# enable_test: false
# - python-version: "manylinux_aarch64"
# archs: "aarch64"
# enable_test: false
# - python-version: "manylinux_armv7l"
# archs: "armv7l"
# enable_test: false
# steps:
# - uses: actions/checkout@v6
# - name: Download stub artifact
# uses: actions/download-artifact@v4
# with:
# name: pysplashsurf.pyi
# path: pysplashsurf/pysplashsurf/
# - uses: actions/setup-python@v6
# with:
# python-version: 3.12
# # QEMU is required for non-native archs
# # https://cibuildwheel.pypa.io/en/stable/faq/#emulation
# - name: Set up QEMU
# if: runner.os == 'Linux'
# uses: docker/setup-qemu-action@v3
# with:
# platforms: all
# - name: Install cibuildwheel
# run: python -m pip install cibuildwheel==3.1.3
# - name: Build wheels with tests
# run: python -m cibuildwheel --output-dir wheelhouse pysplashsurf
# if: matrix.enable_test == true
# env:
# CIBW_BUILD: ${{ format('cp312-{0}', matrix.python-version) }}
# CIBW_ARCHS: ${{ matrix.archs }}
# CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y
# CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH"
# CIBW_TEST_COMMAND: "cargo install --path {project}/splashsurf && pytest pysplashsurf/tests"
# CIBW_TEST_SOURCES: "pysplashsurf/tests"
# CIBW_TEST_REQUIRES: pytest meshio trimesh rtree scipy
# - name: Build wheels without tests
# run: python -m cibuildwheel --output-dir wheelhouse pysplashsurf
# if: matrix.enable_test == false
# env:
# CIBW_BUILD: ${{ format('cp312-{0}', matrix.python-version) }}
# CIBW_ARCHS: ${{ matrix.archs }}
# CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y
# CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH"
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-${{ matrix.python-version }}
# path: wheelhouse
linux_wheels:
name: Build wheels for Linux ${{ matrix.target }}
needs: generate-stub
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
target: [x86_64, i686, aarch64, armv7]
steps:
- uses: actions/checkout@v6
- name: Download stub artifact
uses: actions/download-artifact@v4
with:
name: pysplashsurf.pyi
path: pysplashsurf/pysplashsurf/
- uses: actions/setup-python@v6
with:
python-version: 3.12
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out wheelhouse --auditwheel repair -m pysplashsurf/Cargo.toml -i python3.12
#sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: 2014
- name: Audit & fix wheels
run: |
pip install auditwheel
auditwheel repair wheelhouse/*.whl
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
path: wheelhouse
# macos_wheels:
# name: Build wheels for "${{ matrix.python-version }}"
# needs: generate-stub
# runs-on: ${{ matrix.runner }}
# strategy:
# fail-fast: false
# matrix:
# include:
# - runner: macos-13
# python-version: "macosx_x86_64"
# archs: "x86_64"
# macosx_deployment_target: "13.0"
# - runner: macos-14
# python-version: "macosx_arm64"
# archs: "arm64"
# macosx_deployment_target: "14.0"
# steps:
# - uses: actions/checkout@v6
# - name: Download stub artifact
# uses: actions/download-artifact@v4
# with:
# name: pysplashsurf.pyi
# path: pysplashsurf/pysplashsurf/
# - uses: actions/setup-python@v6
# with:
# python-version: 3.12
# - name: Install cibuildwheel
# run: python -m pip install cibuildwheel==3.1.3
# - name: Build wheels
# run: python -m cibuildwheel --output-dir wheelhouse pysplashsurf
# env:
# CIBW_BUILD: ${{ format('cp312-{0}', matrix.python-version) }}
# CIBW_ARCHS: ${{ matrix.archs }}
# CIBW_ENVIRONMENT_MACOS: "MACOSX_DEPLOYMENT_TARGET=${{ matrix.macosx_deployment_target }}"
# CIBW_TEST_COMMAND: "cargo install --path {project}/splashsurf && pytest pysplashsurf/tests"
# CIBW_TEST_SOURCES: "pysplashsurf/tests"
# CIBW_TEST_REQUIRES: pytest meshio trimesh rtree scipy
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-${{ matrix.python-version }}
# path: wheelhouse
macos_wheels:
name: Build wheels for macOS ${{ matrix.target }}
needs: generate-stub
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v6
- name: Download stub artifact
uses: actions/download-artifact@v4
with:
name: pysplashsurf.pyi
path: pysplashsurf/pysplashsurf/
- uses: actions/setup-python@v6
with:
python-version: 3.12
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out wheelhouse -m pysplashsurf/Cargo.toml -i python3.12
#sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Audit & fix wheels
run: |
pip install delocate
delocate-wheel -v wheelhouse/*.whl
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: wheelhouse
# windows_wheels:
# name: Build wheels for "${{ matrix.python-version }}"
# needs: generate-stub
# runs-on: windows-latest
# strategy:
# fail-fast: false
# matrix:
# include:
# - archs: "AMD64"
# python-version: "win_amd64"
# - archs: "x86"
# python-version: "win32"
# steps:
# - uses: actions/checkout@v6
# - name: Download stub artifact
# uses: actions/download-artifact@v4
# with:
# name: pysplashsurf.pyi
# path: pysplashsurf/pysplashsurf/
# - uses: actions/setup-python@v6
# with:
# python-version: 3.12
# - name: Install cibuildwheel
# run: python -m pip install cibuildwheel==3.1.3
# - name: Build wheels
# run: python -m cibuildwheel --output-dir wheelhouse pysplashsurf
# env:
# CIBW_BUILD: ${{ format('cp312-{0}', matrix.python-version) }}
# CIBW_ARCHS: ${{ matrix.archs }}
# # Tests are broken on Windows because trimesh library tries to write temporary files which fails
# #CIBW_TEST_COMMAND: "cargo install --path {project}/splashsurf && pytest pysplashsurf/tests"
# #CIBW_TEST_SOURCES: "pysplashsurf/tests"
# #CIBW_TEST_REQUIRES: pytest meshio trimesh rtree scipy
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-${{ matrix.python-version }}
# path: wheelhouse
windows_wheels:
name: Build wheels for Windows ${{ matrix.target }}
needs: generate-stub
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: windows-latest
target: x86_64
py-arch: x64
- runner: windows-latest
target: i686
py-arch: x86
- runner: windows-11-arm
target: aarch64
py-arch: arm64
steps:
- uses: actions/checkout@v6
- name: Download stub artifact
uses: actions/download-artifact@v4
with:
name: pysplashsurf.pyi
path: pysplashsurf/pysplashsurf/
- uses: actions/setup-python@v6
with:
python-version: 3.12
architecture: ${{ matrix.py-arch }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out wheelhouse -m pysplashsurf/Cargo.toml -i python3.12
#sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Audit wheels
run: |
pip install delvewheel
delvewheel show -v wheelhouse/*.whl
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.target }}
path: wheelhouse
sdist:
name: Build source distribution
needs: generate-stub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download stub artifact
uses: actions/download-artifact@v4
with:
name: pysplashsurf.pyi
path: pysplashsurf/pysplashsurf/
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist -m pysplashsurf/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') }}
needs: [linux_wheels, macos_wheels, windows_wheels, sdist, tests, docs]
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
- uses: actions/setup-python@v6
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine
- name: Upload wheels
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
ls
twine upload --skip-existing *.whl *.tar.gz
build_wheel_dev:
name: Build wheel for documentation and tests
runs-on: ubuntu-latest
outputs:
filename: ${{ steps.get_filename.outputs.file_name }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.12
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: x86_64
args: --release --out dist --auditwheel repair -m pysplashsurf/Cargo.toml -i python3.12
manylinux: 2014
- name: Get wheel name
id: get_filename
run: |
FILE_NAME=$(ls dist)
echo "file_name=$FILE_NAME" >> $GITHUB_OUTPUT
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: doc_tests_wheel
path: dist
docs:
name: Build documentation
needs: build_wheel_dev
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.12
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: doc_tests_wheel
path: dist/
- name: Append output to file
run: |
echo "./dist/${{ needs.build_wheel_dev.outputs.filename }}" >> pysplashsurf/pysplashsurf/docs/requirements.txt
- uses: ammaraskar/sphinx-action@8.2.3
with:
docs-folder: "pysplashsurf/pysplashsurf/docs/"
- uses: actions/upload-artifact@v4
with:
name: DocumentationHTML
path: pysplashsurf/pysplashsurf/docs/build/html/
read_the_docs:
name: Read the Docs trigger
needs: [docs, publish]
runs-on: ubuntu-latest
steps:
- name: Trigger Read the Docs build
run: |
curl -X POST -d "branches=main" -d "token=${{ secrets.READTHEDOCS_TOKEN }}" https://app.readthedocs.org/api/v2/webhook/pysplashsurf/299116/
tests:
name: Run pytest
needs: build_wheel_dev
defaults:
run:
shell: bash -l {0}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.12
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: pysplashsurf/python_environment.yaml
init-shell: >-
bash
- run: |
conda info
conda list
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: doc_tests_wheel
path: dist/
- run: pip install dist/${{ needs.build_wheel_dev.outputs.filename }}
- name: Install splashsurf CLI
run: cargo install splashsurf --path ./splashsurf
- name: Run pytest
uses: pavelzw/pytest-action@v2
with:
verbose: true
emoji: false
job-summary: true
click-to-expand: true
report-title: 'Pytest Report'