Skip to content

Commit c0d4c91

Browse files
committed
Update CI, run delocate for macOS
1 parent 97fcab0 commit c0d4c91

4 files changed

Lines changed: 237 additions & 87 deletions

File tree

.github/workflows/pysplashsurf_CI.yml

Lines changed: 220 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,79 @@ jobs:
3636
with:
3737
name: pysplashsurf.pyi
3838
path: pysplashsurf/pysplashsurf/
39-
40-
linux:
41-
name: Build wheels for Linux
39+
40+
# linux_wheels:
41+
# name: Build wheels for "${{ matrix.python-version }}"
42+
# needs: generate-stub
43+
# runs-on: ubuntu-24.04
44+
# strategy:
45+
# fail-fast: false
46+
# matrix:
47+
# include:
48+
# - python-version: "manylinux_x86_64"
49+
# archs: "x86_64"
50+
# enable_test: true
51+
# - python-version: "manylinux_i686"
52+
# archs: "i686"
53+
# enable_test: false
54+
# - python-version: "manylinux_aarch64"
55+
# archs: "aarch64"
56+
# enable_test: false
57+
# - python-version: "manylinux_armv7l"
58+
# archs: "armv7l"
59+
# enable_test: false
60+
# steps:
61+
# - uses: actions/checkout@v4
62+
# - name: Download stub artifact
63+
# uses: actions/download-artifact@v4
64+
# with:
65+
# name: pysplashsurf.pyi
66+
# path: pysplashsurf/pysplashsurf/
67+
# - uses: actions/setup-python@v5
68+
# with:
69+
# python-version: 3.12
70+
# # QEMU is required for non-native archs
71+
# # https://cibuildwheel.pypa.io/en/stable/faq/#emulation
72+
# - name: Set up QEMU
73+
# if: runner.os == 'Linux'
74+
# uses: docker/setup-qemu-action@v3
75+
# with:
76+
# platforms: all
77+
# - name: Install cibuildwheel
78+
# run: python -m pip install cibuildwheel==3.1.3
79+
# - name: Build wheels with tests
80+
# run: python -m cibuildwheel --output-dir wheelhouse pysplashsurf
81+
# if: matrix.enable_test == true
82+
# env:
83+
# CIBW_BUILD: ${{ format('cp312-{0}', matrix.python-version) }}
84+
# CIBW_ARCHS: ${{ matrix.archs }}
85+
# CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y
86+
# CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH"
87+
# CIBW_TEST_COMMAND: "cargo install --path {project}/splashsurf && pytest pysplashsurf/tests"
88+
# CIBW_TEST_SOURCES: "pysplashsurf/tests"
89+
# CIBW_TEST_REQUIRES: pytest meshio trimesh rtree scipy
90+
# - name: Build wheels without tests
91+
# run: python -m cibuildwheel --output-dir wheelhouse pysplashsurf
92+
# if: matrix.enable_test == false
93+
# env:
94+
# CIBW_BUILD: ${{ format('cp312-{0}', matrix.python-version) }}
95+
# CIBW_ARCHS: ${{ matrix.archs }}
96+
# CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y
97+
# CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH"
98+
# - name: Upload wheels
99+
# uses: actions/upload-artifact@v4
100+
# with:
101+
# name: wheels-${{ matrix.python-version }}
102+
# path: wheelhouse
103+
104+
linux_wheels:
105+
name: Build wheels for Linux ${{ matrix.target }}
42106
needs: generate-stub
43-
runs-on: ${{ matrix.platform.runner }}
107+
runs-on: ubuntu-24.04
44108
strategy:
109+
fail-fast: false
45110
matrix:
46-
platform:
47-
- runner: ubuntu-24.04
48-
target: x86_64
49-
- runner: ubuntu-24.04
50-
target: x86
51-
- runner: ubuntu-24.04
52-
target: aarch64
53-
- runner: ubuntu-24.04
54-
target: armv7
111+
target: [x86_64, x86, aarch64, armv7]
55112
steps:
56113
- uses: actions/checkout@v4
57114
- name: Download stub artifact
@@ -61,31 +118,79 @@ jobs:
61118
path: pysplashsurf/pysplashsurf/
62119
- uses: actions/setup-python@v5
63120
with:
64-
python-version: 3.x
121+
python-version: 3.12
65122
- name: Build wheels
66123
uses: PyO3/maturin-action@v1
67124
with:
68-
target: ${{ matrix.platform.target }}
69-
args: --release --out dist -m pysplashsurf/Cargo.toml
70-
# sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
71-
manylinux: auto
125+
target: ${{ matrix.target }}
126+
args: --release --out wheelhouse --auditwheel repair -m pysplashsurf/Cargo.toml
127+
#sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
128+
manylinux: 2014
129+
- name: Audit & fix wheels
130+
run: |
131+
pip install auditwheel
132+
auditwheel repair wheelhouse/*.whl
72133
- name: Upload wheels
73134
uses: actions/upload-artifact@v4
74135
with:
75-
name: wheels-linux-${{ matrix.platform.target }}
76-
path: dist
136+
name: wheels-linux-${{ matrix.target }}
137+
path: wheelhouse
77138

78-
windows:
79-
name: Build wheels for Windows
139+
# macos_wheels:
140+
# name: Build wheels for "${{ matrix.python-version }}"
141+
# needs: generate-stub
142+
# runs-on: ${{ matrix.runner }}
143+
# strategy:
144+
# fail-fast: false
145+
# matrix:
146+
# include:
147+
# - runner: macos-13
148+
# python-version: "macosx_x86_64"
149+
# archs: "x86_64"
150+
# macosx_deployment_target: "13.0"
151+
# - runner: macos-14
152+
# python-version: "macosx_arm64"
153+
# archs: "arm64"
154+
# macosx_deployment_target: "14.0"
155+
# steps:
156+
# - uses: actions/checkout@v4
157+
# - name: Download stub artifact
158+
# uses: actions/download-artifact@v4
159+
# with:
160+
# name: pysplashsurf.pyi
161+
# path: pysplashsurf/pysplashsurf/
162+
# - uses: actions/setup-python@v5
163+
# with:
164+
# python-version: 3.12
165+
# - name: Install cibuildwheel
166+
# run: python -m pip install cibuildwheel==3.1.3
167+
# - name: Build wheels
168+
# run: python -m cibuildwheel --output-dir wheelhouse pysplashsurf
169+
# env:
170+
# CIBW_BUILD: ${{ format('cp312-{0}', matrix.python-version) }}
171+
# CIBW_ARCHS: ${{ matrix.archs }}
172+
# CIBW_ENVIRONMENT_MACOS: "MACOSX_DEPLOYMENT_TARGET=${{ matrix.macosx_deployment_target }}"
173+
# CIBW_TEST_COMMAND: "cargo install --path {project}/splashsurf && pytest pysplashsurf/tests"
174+
# CIBW_TEST_SOURCES: "pysplashsurf/tests"
175+
# CIBW_TEST_REQUIRES: pytest meshio trimesh rtree scipy
176+
# - name: Upload wheels
177+
# uses: actions/upload-artifact@v4
178+
# with:
179+
# name: wheels-${{ matrix.python-version }}
180+
# path: wheelhouse
181+
182+
macos_wheels:
183+
name: Build wheels for macOS ${{ matrix.target }}
80184
needs: generate-stub
81-
runs-on: ${{ matrix.platform.runner }}
185+
runs-on: ${{ matrix.runner }}
82186
strategy:
187+
fail-fast: false
83188
matrix:
84-
platform:
85-
- runner: windows-latest
86-
target: x64
87-
- runner: windows-latest
88-
target: x86
189+
include:
190+
- runner: macos-13
191+
target: x86_64
192+
- runner: macos-14
193+
target: aarch64
89194
steps:
90195
- uses: actions/checkout@v4
91196
- name: Download stub artifact
@@ -95,31 +200,70 @@ jobs:
95200
path: pysplashsurf/pysplashsurf/
96201
- uses: actions/setup-python@v5
97202
with:
98-
python-version: 3.x
99-
architecture: ${{ matrix.platform.target }}
203+
python-version: 3.12
100204
- name: Build wheels
101205
uses: PyO3/maturin-action@v1
102206
with:
103-
target: ${{ matrix.platform.target }}
104-
args: --release --out dist -m pysplashsurf\Cargo.toml
105-
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
207+
target: ${{ matrix.target }}
208+
args: --release --out wheelhouse -m pysplashsurf/Cargo.toml
209+
#sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
210+
- name: Audit & fix wheels
211+
run: |
212+
pip install delocate
213+
delocate-wheel -v wheelhouse/*.whl
106214
- name: Upload wheels
107215
uses: actions/upload-artifact@v4
108216
with:
109-
name: wheels-windows-${{ matrix.platform.target }}
110-
path: dist
217+
name: wheels-macos-${{ matrix.target }}
218+
path: wheelhouse
111219

112-
macos:
113-
name: Build wheels for macOS
220+
# windows_wheels:
221+
# name: Build wheels for "${{ matrix.python-version }}"
222+
# needs: generate-stub
223+
# runs-on: windows-latest
224+
# strategy:
225+
# fail-fast: false
226+
# matrix:
227+
# include:
228+
# - archs: "AMD64"
229+
# python-version: "win_amd64"
230+
# - archs: "x86"
231+
# python-version: "win32"
232+
# steps:
233+
# - uses: actions/checkout@v4
234+
# - name: Download stub artifact
235+
# uses: actions/download-artifact@v4
236+
# with:
237+
# name: pysplashsurf.pyi
238+
# path: pysplashsurf/pysplashsurf/
239+
# - uses: actions/setup-python@v5
240+
# with:
241+
# python-version: 3.12
242+
# - name: Install cibuildwheel
243+
# run: python -m pip install cibuildwheel==3.1.3
244+
# - name: Build wheels
245+
# run: python -m cibuildwheel --output-dir wheelhouse pysplashsurf
246+
# env:
247+
# CIBW_BUILD: ${{ format('cp312-{0}', matrix.python-version) }}
248+
# CIBW_ARCHS: ${{ matrix.archs }}
249+
# # Tests are broken on Windows because trimesh library tries to write temporary files which fails
250+
# #CIBW_TEST_COMMAND: "cargo install --path {project}/splashsurf && pytest pysplashsurf/tests"
251+
# #CIBW_TEST_SOURCES: "pysplashsurf/tests"
252+
# #CIBW_TEST_REQUIRES: pytest meshio trimesh rtree scipy
253+
# - name: Upload wheels
254+
# uses: actions/upload-artifact@v4
255+
# with:
256+
# name: wheels-${{ matrix.python-version }}
257+
# path: wheelhouse
258+
259+
windows_wheels:
260+
name: Build wheels for Windows ${{ matrix.target }}
114261
needs: generate-stub
115-
runs-on: ${{ matrix.platform.runner }}
262+
runs-on: windows-latest
116263
strategy:
264+
fail-fast: false
117265
matrix:
118-
platform:
119-
- runner: macos-13
120-
target: x86_64
121-
- runner: macos-14
122-
target: aarch64
266+
target: [x64, x86]
123267
steps:
124268
- uses: actions/checkout@v4
125269
- name: Download stub artifact
@@ -129,18 +273,23 @@ jobs:
129273
path: pysplashsurf/pysplashsurf/
130274
- uses: actions/setup-python@v5
131275
with:
132-
python-version: 3.x
276+
python-version: 3.12
277+
architecture: ${{ matrix.target }}
133278
- name: Build wheels
134279
uses: PyO3/maturin-action@v1
135280
with:
136-
target: ${{ matrix.platform.target }}
137-
args: --release --out dist -m pysplashsurf/Cargo.toml
138-
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
281+
target: ${{ matrix.target }}
282+
args: --release --out wheelhouse -m pysplashsurf/Cargo.toml
283+
#sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
284+
- name: Audit wheels
285+
run: |
286+
pip install delvewheel
287+
delvewheel show -v wheelhouse/*.whl
139288
- name: Upload wheels
140289
uses: actions/upload-artifact@v4
141290
with:
142-
name: wheels-macos-${{ matrix.platform.target }}
143-
path: dist
291+
name: wheels-windows-${{ matrix.target }}
292+
path: wheelhouse
144293

145294
sdist:
146295
name: Build source distribution
@@ -168,30 +317,28 @@ jobs:
168317
name: Publish to PyPI
169318
runs-on: ubuntu-latest
170319
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' }}
171-
needs: [linux, windows, macos, sdist, tests]
172-
permissions:
173-
# Use to sign the release artifacts
174-
id-token: write
175-
# Used to upload release artifacts
176-
contents: write
177-
# Used to generate artifact attestation
178-
attestations: write
320+
needs: [linux_wheels, macos_wheels, windows_wheels, sdist, tests, docs]
179321
steps:
180322
- uses: actions/download-artifact@v4
181-
#- name: Generate artifact attestation
182-
# uses: actions/attest-build-provenance@v1
183-
# with:
184-
# subject-path: 'wheels-*/*'
185-
- name: Publish to PyPI
186-
#if: ${{ startsWith(github.ref, 'refs/tags/') }}
187-
uses: PyO3/maturin-action@v1
188-
env:
189-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
190323
with:
191-
command: upload
192-
args: --non-interactive --skip-existing wheels-*/*
324+
pattern: wheels-*
325+
merge-multiple: true
326+
- uses: actions/setup-python@v5
327+
with:
328+
python-version: 3.x
329+
- name: Install dependencies
330+
run: |
331+
python -m pip install --upgrade pip
332+
pip install twine
333+
- name: Test
334+
env:
335+
TWINE_USERNAME: __token__
336+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
337+
run: |
338+
ls
339+
twine upload *.whl --skip-existing
193340
194-
build_wheel:
341+
build_wheel_dev:
195342
name: Build wheel for documentation and tests
196343
runs-on: ubuntu-latest
197344
outputs:
@@ -220,7 +367,7 @@ jobs:
220367

221368
docs:
222369
name: Build documentation
223-
needs: build_wheel
370+
needs: build_wheel_dev
224371
runs-on: ubuntu-latest
225372
steps:
226373
- uses: actions/checkout@v4
@@ -234,7 +381,7 @@ jobs:
234381
path: dist/
235382
- name: Append output to file
236383
run: |
237-
echo "./dist/${{ needs.build_wheel.outputs.filename }}" >> pysplashsurf/pysplashsurf/docs/requirements.txt
384+
echo "./dist/${{ needs.build_wheel_dev.outputs.filename }}" >> pysplashsurf/pysplashsurf/docs/requirements.txt
238385
- uses: ammaraskar/sphinx-action@8.2.3
239386
with:
240387
docs-folder: "pysplashsurf/pysplashsurf/docs/"
@@ -254,7 +401,7 @@ jobs:
254401
255402
tests:
256403
name: Run pytest
257-
needs: build_wheel
404+
needs: build_wheel_dev
258405
defaults:
259406
run:
260407
shell: bash -l {0}
@@ -277,7 +424,7 @@ jobs:
277424
with:
278425
name: doc_tests_wheel
279426
path: dist/
280-
- run: pip install dist/${{ needs.build_wheel.outputs.filename }}
427+
- run: pip install dist/${{ needs.build_wheel_dev.outputs.filename }}
281428
- name: Install splashsurf CLI
282429
run: cargo install splashsurf
283430
- name: Run pytest
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)