Skip to content

Commit 7463d9d

Browse files
authored
[Build] Modernize wheel build pipeline with Apple Silicon support and updated infrastructure (#530)
[Build] Upgrade building wheels
1 parent 0398cf6 commit 7463d9d

1 file changed

Lines changed: 76 additions & 25 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 76 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,83 +51,124 @@ jobs:
5151
platform_id: win_amd64
5252

5353
# Linux 64 bit manylinux2014
54-
- os: ubuntu-20.04
54+
- os: ubuntu-22.04
5555
python: 36
5656
bitness: 64
5757
platform_id: manylinux_x86_64
5858
manylinux_image: manylinux2014
59-
- os: ubuntu-20.04
59+
- os: ubuntu-22.04
6060
python: 37
6161
bitness: 64
6262
platform_id: manylinux_x86_64
6363
manylinux_image: manylinux2014
64-
- os: ubuntu-20.04
64+
- os: ubuntu-22.04
6565
python: 38
6666
bitness: 64
6767
platform_id: manylinux_x86_64
6868
manylinux_image: manylinux2014
69-
- os: ubuntu-20.04
69+
- os: ubuntu-22.04
7070
python: 39
7171
bitness: 64
7272
platform_id: manylinux_x86_64
7373
manylinux_image: manylinux2014
74-
- os: ubuntu-20.04
74+
- os: ubuntu-22.04
7575
python: 310
7676
bitness: 64
7777
platform_id: manylinux_x86_64
7878
manylinux_image: manylinux2014
79-
- os: ubuntu-20.04
79+
- os: ubuntu-22.04
8080
python: 311
8181
bitness: 64
8282
platform_id: manylinux_x86_64
8383
manylinux_image: manylinux2014
8484

85-
# MacOS x86_64
86-
- os: macos-12
85+
# MacOS x86_64 (Cross-compiled on Apple Silicon)
86+
- os: macos-latest
8787
bitness: 64
8888
python: 36
8989
platform_id: macosx_x86_64
90-
- os: macos-12
90+
arch: x86_64
91+
- os: macos-latest
9192
bitness: 64
9293
python: 37
9394
platform_id: macosx_x86_64
94-
- os: macos-12
95+
arch: x86_64
96+
- os: macos-latest
9597
bitness: 64
9698
python: 38
9799
platform_id: macosx_x86_64
98-
- os: macos-12
100+
arch: x86_64
101+
- os: macos-latest
99102
bitness: 64
100103
python: 39
101104
platform_id: macosx_x86_64
102-
- os: macos-12
105+
arch: x86_64
106+
- os: macos-latest
103107
bitness: 64
104108
python: 310
105109
platform_id: macosx_x86_64
106-
- os: macos-12
110+
arch: x86_64
111+
- os: macos-latest
107112
bitness: 64
108113
python: 311
109114
platform_id: macosx_x86_64
115+
arch: x86_64
116+
117+
# MacOS ARM64 (Native on Apple Silicon)
118+
- os: macos-latest
119+
bitness: 64
120+
python: 38
121+
platform_id: macosx_arm64
122+
arch: arm64
123+
- os: macos-latest
124+
bitness: 64
125+
python: 39
126+
platform_id: macosx_arm64
127+
arch: arm64
128+
- os: macos-latest
129+
bitness: 64
130+
python: 310
131+
platform_id: macosx_arm64
132+
arch: arm64
133+
- os: macos-latest
134+
bitness: 64
135+
python: 311
136+
platform_id: macosx_arm64
137+
arch: arm64
110138

111139
steps:
112140
- name: Checkout
113141
uses: actions/checkout@v4
114142

115-
- name: Setup Python
143+
- name: Set up Python
116144
uses: actions/setup-python@v5
117145
with:
118-
python-version: '3.8'
119-
cache: 'pip'
146+
python-version: '3.12'
120147

121-
- name: Install dependencies
148+
- name: Install dependencies (Python 3.6-3.7)
149+
if: matrix.python == '36' || matrix.python == '37'
122150
run: |
123151
python -m pip install --upgrade pip
124152
python -m pip install cibuildwheel==2.16.2
125153
154+
- name: Install dependencies (Python 3.8+)
155+
if: matrix.python != '36' && matrix.python != '37'
156+
run: |
157+
python -m pip install --upgrade pip
158+
python -m pip install cibuildwheel>=2.20.0
159+
126160
- name: Build wheels
127161
env:
128162
CIBW_BEFORE_BUILD: python -m pip install numpy>=1.19.5 cython>=0.29.0 scipy>=1.7.0
129163
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
130164
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
165+
# Enable cross-compilation for macOS (only on macos-latest)
166+
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
167+
# Set deployment target based on runner type
168+
CIBW_ENVIRONMENT_MACOS: >
169+
MACOSX_DEPLOYMENT_TARGET=${{ (matrix.python == '36' || matrix.python == '37') && '10.9' || '11.0' }}
170+
# Skip tests on cross-compiled wheels (only for macos-latest)
171+
CIBW_TEST_SKIP: ${{ matrix.os == 'macos-latest' && '*-macosx_x86_64 *-macosx_arm64' || '' }}
131172
CIBW_BUILD_VERBOSITY: 1
132173
run: cibuildwheel --output-dir wheelhouse
133174

@@ -138,21 +179,31 @@ jobs:
138179
path: wheelhouse/*.whl
139180

140181
merge_wheels:
182+
name: Merge wheels
141183
needs: build_wheels
142184
runs-on: ubuntu-latest
185+
143186
steps:
144-
- name: Merge All Wheels
145-
uses: actions/download-artifact@v4
146-
with:
147-
path: wheels
148-
pattern: wheels-cp*
149-
merge-multiple: true
150-
- run: ls -R wheels
187+
- name: Download all artifacts
188+
uses: actions/download-artifact@v4
189+
with:
190+
path: dist
191+
pattern: wheels-*
192+
merge-multiple: true
193+
194+
- name: List downloaded wheels
195+
run: ls -R dist/
196+
197+
- name: Upload merged wheels
198+
uses: actions/upload-artifact@v4
199+
with:
200+
name: "💘💘💘all-wheels💘💘💘"
201+
path: dist/*.whl
151202

152203
# Build the source distribution under Linux
153204
build_sdist:
154205
name: Source distribution
155-
runs-on: ubuntu-20.04
206+
runs-on: ubuntu-22.04
156207

157208
steps:
158209
- name: Checkout

0 commit comments

Comments
 (0)