Skip to content

Commit bd0dd0c

Browse files
CI: update script to generate multiple wheels per job
1 parent 7edc6d4 commit bd0dd0c

3 files changed

Lines changed: 41 additions & 76 deletions

File tree

.github/workflows/build-wheels.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,12 @@ on:
1212
description: 'VTK version to use, must match the one in pyproject.toml'
1313
required: true
1414
type: string
15-
python-version:
16-
description: 'Python version to set up (e.g., 3.10)'
17-
required: true
18-
type: string
19-
build-target:
15+
build-targets:
2016
description: 'CIBW build target (e.g., cp310-manylinux_x86_64)'
2117
required: true
2218
type: string
23-
wheel-tag:
24-
description: 'Wheel tag to apply after building. Ignored on Windows.'
19+
platform-tag:
20+
description: 'Wheel platform tag to apply after building. Ignored on Windows.'
2521
required: true
2622
type: string
2723
macosx-deployment-target:
@@ -46,7 +42,7 @@ jobs:
4642

4743
env:
4844
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macosx-deployment-target }}
49-
CIBW_BUILD: ${{ inputs.build-target }}
45+
CIBW_BUILD: ${{ inputs.build-targets }}
5046
# cibuildwheel creates a docker container for building our wheel
5147
# This is all the required steps to use host ccache correctly
5248
# Note that this is only needed on linux, as Mac and Windows do not use docker containers
@@ -69,11 +65,11 @@ jobs:
6965
# SlicerCore uses extensive CMake logic to package everything as needed, do not try this at home!
7066
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "
7167
python -m pip install wheel &&
72-
python -m wheel tags --platform-tag ${{ inputs.wheel-tag }} --remove {wheel} &&
68+
python -m wheel tags --platform-tag ${{ inputs.platform-tag }} --remove {wheel} &&
7369
cp $(dirname {wheel})/slicer_core*.whl {dest_dir}"
7470
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "
7571
python -m pip install wheel &&
76-
python -m wheel tags --platform-tag ${{ inputs.wheel-tag }} --remove {wheel} &&
72+
python -m wheel tags --platform-tag ${{ inputs.platform-tag }} --remove {wheel} &&
7773
cp $(dirname {wheel})/slicer_core*.whl {dest_dir}"
7874

7975
steps:
@@ -122,14 +118,6 @@ jobs:
122118
- uses: ilammy/msvc-dev-cmd@v1.13.0
123119
if: ${{ !inputs.dry-run }}
124120

125-
- name: Set up Python ${{ inputs.python-version }}
126-
if: ${{ !inputs.dry-run }}
127-
uses: actions/setup-python@v5
128-
with:
129-
python-version: ${{ inputs.python-version }}
130-
cache: 'pip'
131-
cache-dependency-path: 'pyproject.toml'
132-
133121
- name: Apply patch
134122
if: ${{ !inputs.dry-run }}
135123
run: python apply_patch.py && python set_vtk_version.py ${{ inputs.vtk-tag }}
@@ -147,15 +135,15 @@ jobs:
147135
if: ${{ inputs.dry-run && runner.os != 'Windows' }}
148136
run: |
149137
mkdir wheelhouse
150-
zip wheelhouse/slicer_core-0.0.1-${{ inputs.python-version }}-${{ inputs.wheel-tag }}.whl README.md
151-
zip wheelhouse/slicer_core_sdk-0.0.1-${{ inputs.python-version }}-${{ inputs.wheel-tag }}.whl README.md
138+
zip wheelhouse/slicer_core-0.0.1-${{ inputs.platform-tag }}.whl README.md
139+
zip wheelhouse/slicer_core_sdk-0.0.1-${{ inputs.platform-tag }}.whl README.md
152140
153141
- name: Dry-run create wheels
154142
if: ${{ inputs.dry-run && runner.os == 'Windows' }}
155143
run: |
156144
mkdir wheelhouse
157-
Compress-Archive -Path README.md -DestinationPath wheelhouse/slicer_core-0.0.1-${{ inputs.python-version }}-${{ inputs.wheel-tag }}.whl
158-
Compress-Archive -Path README.md -DestinationPath wheelhouse/slicer_core_sdk-0.0.1-${{ inputs.python-version }}-${{ inputs.wheel-tag }}.whl
145+
Compress-Archive -Path README.md -DestinationPath wheelhouse/slicer_core-0.0.1-${{ inputs.platform-tag }}.whl
146+
Compress-Archive -Path README.md -DestinationPath wheelhouse/slicer_core_sdk-0.0.1-${{ inputs.platform-tag }}.whl
159147
160148
- name: ccache stats (after Runtime build)
161149
if: ${{ inputs.use-cache && !inputs.dry-run }}
@@ -164,7 +152,7 @@ jobs:
164152
- name: Upload wheel artifact
165153
uses: actions/upload-artifact@v4
166154
with:
167-
name: slicer_core-${{ inputs.python-version }}-${{ inputs.build-target }}
155+
name: slicer_core-${{ matrix.os }}
168156
path: wheelhouse/slicer_core-*.whl
169157

170158
- name: Build wheel SDK
@@ -183,7 +171,7 @@ jobs:
183171
- name: Upload wheel SDK artifact
184172
uses: actions/upload-artifact@v4
185173
with:
186-
name: slicer_core_sdk-${{ inputs.python-version }}-${{ inputs.build-target }}
174+
name: slicer_core_sdk-${{ matrix.os }}
187175
path: wheelhouse/slicer_core_sdk-*.whl
188176

189177
- name: Save ccache

.github/workflows/cd.yml

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,23 @@ jobs:
99
matrix:
1010
os: [ubuntu-latest, windows-latest, macos-15]
1111
vtk-tag: ['9.6.0']
12-
python-version: ['3.10', '3.11', '3.12', '3.13']
13-
include:
14-
# Python version to CPython abi tag
15-
- python-version: '3.10'
16-
cp-tag: 'cp310'
17-
- python-version: '3.11'
18-
cp-tag: 'cp311'
19-
- python-version: '3.12'
20-
cp-tag: 'cp312'
21-
- python-version: '3.13'
22-
cp-tag: 'cp313'
23-
# OS name to ciwheelbuild platform name
12+
include: # OS name to ciwheelbuild platform name
2413
- os: ubuntu-latest
25-
platform-tag: manylinux_x86_64
26-
wheel-tag: manylinux_2_28_x86_64
14+
platform-tag: manylinux_2_28_x86_64
15+
build-targets: "cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64"
2716
- os: windows-latest
2817
platform-tag: win_amd64
29-
wheel-tag: win_amd64
18+
build-targets: "cp310-win_amd64 cp311-win_amd64 cp312-win_amd64 cp313-win_amd64"
3019
- os: macos-15
31-
platform-tag: macosx_arm64
32-
wheel-tag: macosx_11_0_arm64
20+
platform-tag: macosx_11_0_arm64
21+
build-targets: "cp310-macosx_arm64 cp311-macosx_arm64 cp312-macosx_arm64 cp313-macosx_arm64"
3322
uses: ./.github/workflows/build-wheels.yml
3423
with:
35-
# Map the matrix variables to the reusable workflow's inputs
3624
os: ${{ matrix.os }}
3725
vtk-tag: ${{ matrix.vtk-tag }}
38-
python-version: ${{ matrix.python-version }}
39-
build-target: ${{ matrix.cp-tag }}-${{ matrix.platform-tag }}
40-
wheel-tag: ${{ matrix.wheel-tag }}
41-
use-cache: true
42-
dry-run: true
26+
build-targets: ${{ matrix.build-targets }}
27+
platform-tag: ${{ matrix.platform-tag }}
28+
macosx-deployment-target: "11.0"
4329

4430
upload-github:
4531
name: Push SlicerCore release on github
@@ -61,12 +47,12 @@ jobs:
6147
- name: Show downloaded wheels
6248
run: ls ./wheelhouse
6349

64-
#- name: Publish Release and Attach Wheels
65-
# uses: softprops/action-gh-release@v2
66-
# with:
67-
# generate_release_notes: true
68-
# # Attach all the downloaded wheels to the GitHub Release page
69-
# files: ./wheelhouse/*.whl
50+
- name: Publish Release and Attach Wheels
51+
uses: softprops/action-gh-release@v2
52+
with:
53+
generate_release_notes: true
54+
# Attach all the downloaded wheels to the GitHub Release page
55+
files: ./wheelhouse/*.whl
7056

7157

7258
upload-pypi:
@@ -95,7 +81,7 @@ jobs:
9581
run: ls ./wheelhouse
9682

9783
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
98-
#- name: Publish package distributions to PyPI
99-
# uses: pypa/gh-action-pypi-publish@release/v1
100-
# with:
101-
# packages-dir: ./wheelhouse
84+
- name: Publish package distributions to PyPI
85+
uses: pypa/gh-action-pypi-publish@release/v1
86+
with:
87+
packages-dir: ./wheelhouse

.github/workflows/ci.yml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,21 @@ jobs:
1010
fail-fast: true
1111
matrix:
1212
os: [ubuntu-latest, windows-latest, macos-15]
13-
vtk-tag: ['9.6.0'] # pyproject enforces this specific version
14-
python-version: ['3.10']
15-
include:
16-
# Python version to CPython abi tag
17-
- python-version: '3.10'
18-
cp-tag: 'cp310'
19-
# OS name to ciwheelbuild platform name
13+
vtk-tag: ['9.6.0']
14+
include: # OS name to ciwheelbuild platform name
2015
- os: ubuntu-latest
21-
platform-tag: manylinux_x86_64
22-
wheel-tag: manylinux_2_28_x86_64
16+
platform-tag: manylinux_2_28_x86_64
17+
build-targets: "cp310-manylinux_x86_64"
2318
- os: windows-latest
2419
platform-tag: win_amd64
25-
wheel-tag: win_amd64
20+
build-targets: "cp310-win_amd64"
2621
- os: macos-15
27-
platform-tag: macosx_arm64
28-
wheel-tag: macosx_11_0_arm64
29-
macosx-deployment-target: "11.0"
22+
platform-tag: macosx_11_0_arm64
23+
build-targets: "cp310-macosx_arm64"
3024
uses: ./.github/workflows/build-wheels.yml
3125
with:
32-
# Map the matrix variables to the reusable workflow's inputs
3326
os: ${{ matrix.os }}
3427
vtk-tag: ${{ matrix.vtk-tag }}
35-
python-version: ${{ matrix.python-version }}
36-
build-target: ${{ matrix.cp-tag }}-${{ matrix.platform-tag }}
37-
wheel-tag: ${{ matrix.wheel-tag }}
38-
use-cache: true
39-
dry-run: true
28+
build-targets: ${{ matrix.build-targets }}
29+
platform-tag: ${{ matrix.platform-tag }}
30+
macosx-deployment-target: "11.0"

0 commit comments

Comments
 (0)