Skip to content

Commit fb7d30a

Browse files
committed
Make universal2 wheels on macos
1 parent efc6afd commit fb7d30a

File tree

1 file changed

+57
-10
lines changed

1 file changed

+57
-10
lines changed

.github/workflows/build-macos.yml

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,7 @@ jobs:
7070
env:
7171
MAC_ARCH: ${{ matrix.macarch }}
7272

73-
# Explicitly tell CIBW what the wheel arch deployment target should be
74-
# There seems to be no better way to set this than this env
75-
# We need this because our minimum is 10.11, different from default
76-
# of 10.9 on x86s
77-
# Related issue: https://github.com/pypa/cibuildwheel/issues/952
78-
_PYTHON_HOST_PLATFORM: ${{ matrix.macarch == 'x86_64' && 'macosx-10.11-x86_64' || 'macosx-11.0-arm64'}}
79-
80-
# Similarly, we need to tell CIBW that the wheel's linking steps
81-
# should be for 10.11 on x86
73+
# We need to tell CIBW that the wheel's linking steps should be for 10.11 on x86
8274
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macarch == 'x86_64' && '10.11' || '11.0' }}
8375

8476
CIBW_ARCHS: ${{ matrix.macarch }}
@@ -122,6 +114,61 @@ jobs:
122114

123115
- uses: actions/upload-artifact@v6
124116
with:
125-
name: pygame-wheels-macos-${{ matrix.macarch }}
117+
name: macos-partial-${{ matrix.macarch }}
118+
path: ./wheelhouse/*.whl
119+
compression-level: 0 # wheels are already zip files, no need for more compression
120+
121+
universal2:
122+
needs: build
123+
runs-on: macos-15
124+
steps:
125+
- name: Download artifacts
126+
uses: actions/download-artifact@v7
127+
with:
128+
merge-multiple: true
129+
130+
- name: Generate universal2 wheels
131+
run: |
132+
set -euo pipefail
133+
shopt -s nullglob
134+
135+
pipx install delocate
136+
137+
OUT_DIR="wheelhouse"
138+
mkdir -p "$OUT_DIR"
139+
for arm in *arm64.whl; do
140+
x86="${arm/arm64/x86_64}"
141+
if [[ ! -f "$x86" ]]; then
142+
echo "Copying arm wheel as is (missing x86 component): $arm"
143+
mv "$arm" "$OUT_DIR"
144+
continue
145+
fi
146+
echo "Merging:"
147+
echo " ARM: $arm"
148+
echo " X86: $x86"
149+
delocate-merge "$arm" "$x86" -w "$OUT_DIR"
150+
rm "$x86"
151+
done
152+
for x86 in *x86_64.whl; do
153+
echo "Copying x86_64 wheel as is (missing arm component): $x86"
154+
mv "$x86" "$OUT_DIR"
155+
done
156+
157+
- name: Sanity check - install and test a single universal2 wheel
158+
env:
159+
# Pip now forces us to either make a venv or set this flag, so we will do
160+
# this
161+
PIP_BREAK_SYSTEM_PACKAGES: 1
162+
# We are using dependencies installed from apt
163+
PG_DEPS_FROM_SYSTEM: 1
164+
SDL_VIDEODRIVER: "dummy"
165+
SDL_AUDIODRIVER: "disk"
166+
run: |
167+
python3 -m pip install wheelhouse/*.whl
168+
python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300
169+
170+
- uses: actions/upload-artifact@v6
171+
with:
172+
name: pygame-wheels-macos
126173
path: ./wheelhouse/*.whl
127174
compression-level: 0 # wheels are already zip files, no need for more compression

0 commit comments

Comments
 (0)