Skip to content

Commit 15fc2fb

Browse files
committed
[Build] Upgrade building wheels
1 parent 0398cf6 commit 15fc2fb

1 file changed

Lines changed: 74 additions & 28 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 74 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -51,83 +51,119 @@ 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
116-
uses: actions/setup-python@v5
117-
with:
118-
python-version: '3.8'
119-
cache: 'pip'
120-
121-
- name: Install dependencies
143+
- name: Install dependencies (Python 3.6-3.7)
144+
if: matrix.python == '36' || matrix.python == '37'
122145
run: |
123146
python -m pip install --upgrade pip
124147
python -m pip install cibuildwheel==2.16.2
125148
149+
- name: Install dependencies (Python 3.8+)
150+
if: matrix.python != '36' && matrix.python != '37'
151+
run: |
152+
python -m pip install --upgrade pip
153+
python -m pip install cibuildwheel>=2.20.0
154+
126155
- name: Build wheels
127156
env:
128157
CIBW_BEFORE_BUILD: python -m pip install numpy>=1.19.5 cython>=0.29.0 scipy>=1.7.0
129158
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
130159
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
160+
# Enable cross-compilation for macOS (only on macos-latest)
161+
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
162+
# Set deployment target based on runner type
163+
CIBW_ENVIRONMENT_MACOS: >
164+
MACOSX_DEPLOYMENT_TARGET=${{ (matrix.python == '36' || matrix.python == '37') && '10.9' || '11.0' }}
165+
# Skip tests on cross-compiled wheels (only for macos-latest)
166+
CIBW_TEST_SKIP: ${{ matrix.os == 'macos-latest' && '*-macosx_x86_64 *-macosx_arm64' || '' }}
131167
CIBW_BUILD_VERBOSITY: 1
132168
run: cibuildwheel --output-dir wheelhouse
133169

@@ -138,21 +174,31 @@ jobs:
138174
path: wheelhouse/*.whl
139175

140176
merge_wheels:
177+
name: Merge wheels
141178
needs: build_wheels
142179
runs-on: ubuntu-latest
180+
143181
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
182+
- name: Download all artifacts
183+
uses: actions/download-artifact@v4
184+
with:
185+
path: dist
186+
pattern: wheels-*
187+
merge-multiple: true
188+
189+
- name: List downloaded wheels
190+
run: ls -la dist/
191+
192+
- name: Upload merged wheels
193+
uses: actions/upload-artifact@v4
194+
with:
195+
name: all-wheels
196+
path: dist/*.whl
151197

152198
# Build the source distribution under Linux
153199
build_sdist:
154200
name: Source distribution
155-
runs-on: ubuntu-20.04
201+
runs-on: ubuntu-22.04
156202

157203
steps:
158204
- name: Checkout

0 commit comments

Comments
 (0)