Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 049dd78

Browse files
committed
BLD: Add universal2 wheels [wheel build]
1 parent ae270c3 commit 049dd78

File tree

1 file changed

+60
-5
lines changed

1 file changed

+60
-5
lines changed

.github/workflows/wheels.yml

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,7 @@ jobs:
109109
OPENBLAS=${{ env.IS_32_BIT == 'true' && 'openblas' || '' }}
110110
CFLAGS='${{ env.IS_32_BIT == 'true' && '-m32' || '' }}'
111111
LDFLAGS='${{ env.IS_32_BIT == 'true' && '-m32' || '' }}'
112-
# TODO: Add universal2 wheels, we need to fuse them manually
113-
# instead of going through cibuildwheel
114-
# This is because cibuildwheel tries to make a fat wheel
115-
# https://github.com/multi-build/multibuild/blame/devel/README.rst#L541-L565
116-
# for more info
112+
# universal2 done separately by manually fusing
117113
CIBW_ARCHS_MACOS: x86_64 arm64
118114
CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64"
119115
CIBW_BUILD_VERBOSITY: 3
@@ -125,3 +121,62 @@ jobs:
125121
with:
126122
name: ${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }}
127123
path: ./wheelhouse/*.whl
124+
build_universal2_wheels:
125+
needs: build_wheels
126+
name: Build wheel for ${{ matrix.python[0] }}-macosx-universal2
127+
runs-on: macos-10.15
128+
strategy:
129+
# Ensure that a wheel builder finishes even if another fails
130+
fail-fast: false
131+
matrix:
132+
python:
133+
- ['cp38', '3.8']
134+
- ['cp39', '3.9']
135+
- ['cp310', '3.10']
136+
steps:
137+
- name: Checkout numpy
138+
uses: actions/checkout@v2
139+
with:
140+
submodules: true
141+
# versioneer.py requires the latest tag to be reachable. Here we
142+
# fetch the complete history to get access to the tags.
143+
# A shallow clone can work when the following issue is resolved:
144+
# https://github.com/actions/checkout/issues/338
145+
fetch-depth: 0
146+
- uses: actions/checkout@v2
147+
- name: Set up Python
148+
uses: actions/setup-python@v2
149+
with:
150+
python-version: ${{ matrix.python[1] }}
151+
architecture: x64
152+
- uses: actions/download-artifact@master
153+
with:
154+
name: ${{ matrix.python[0] }}-macosx
155+
path: ./osx-wheels
156+
- name: Fuse wheels
157+
run: |
158+
pip install delocate
159+
wheelnames=$(find "$(pwd)/osx-wheels" -name "*.whl")
160+
echo ${wheelnames[*]}
161+
mkdir wheelhouse
162+
delocate-fuse ${wheelnames[@]} -w wheelhouse
163+
# delocate produces wheel with wrong filename
164+
# rename to universal2 (FWIW, multibuild does this too)
165+
wheelpath=$(find "$(pwd)/wheelhouse" -name "*.whl")
166+
# Hardcoding this for now
167+
# TODO: don't hardcode paths, this is tricky since we also
168+
# are changing macosx SDK versions from 11 -> 10.9
169+
newpath="${wheelpath/_11_0_arm64.whl/_10_9_universal2.whl}"
170+
newpath="${newpath/_10_9_x86_64.whl/_10_9_universal2.whl}"
171+
mv $wheelpath $newpath
172+
ls wheelhouse
173+
- name: Install wheels and test
174+
run: |
175+
pip install --find-links wheelhouse --no-index numpy
176+
pip install -r test_requirements.txt
177+
cd .. # Can't import numpy while inside numpy dir
178+
bash numpy/tools/wheels/cibw_test_command.sh numpy
179+
- uses: actions/upload-artifact@v2
180+
with:
181+
name: ${{ matrix.python[0] }}-macosx
182+
path: ./wheelhouse/*.whl

0 commit comments

Comments
 (0)