Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 58 additions & 10 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,7 @@ jobs:
env:
MAC_ARCH: ${{ matrix.macarch }}

# Explicitly tell CIBW what the wheel arch deployment target should be
# There seems to be no better way to set this than this env
# We need this because our minimum is 10.11, different from default
# of 10.9 on x86s
# Related issue: https://github.com/pypa/cibuildwheel/issues/952
_PYTHON_HOST_PLATFORM: ${{ matrix.macarch == 'x86_64' && 'macosx-10.11-x86_64' || 'macosx-11.0-arm64'}}

# Similarly, we need to tell CIBW that the wheel's linking steps
# should be for 10.11 on x86
# We need to tell CIBW that the wheel's linking steps should be for 10.11 on x86
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macarch == 'x86_64' && '10.11' || '11.0' }}

CIBW_ARCHS: ${{ matrix.macarch }}
Expand Down Expand Up @@ -122,6 +114,62 @@ jobs:

- uses: actions/upload-artifact@v6
with:
name: pygame-wheels-macos-${{ matrix.macarch }}
name: macos-partial-${{ matrix.macarch }}
path: ./wheelhouse/*.whl
compression-level: 0 # wheels are already zip files, no need for more compression

universal2:
needs: build
runs-on: macos-15
steps:
- name: Download artifacts
uses: actions/download-artifact@v7
with:
merge-multiple: true

# Here we iterate over all our arm wheels, and get the corresponding intel wheel
# (matching version) and use delocate-merge to generate the final universal2
# wheel.
- name: Generate universal2 wheels
run: |
set -euo pipefail
shopt -s nullglob

pipx install delocate==0.13.0

OUT_DIR="wheelhouse"
mkdir -p "$OUT_DIR"
for arm in *arm64.whl; do
x86="$(ls "$(echo "$arm" | cut -d- -f1-4)"-macosx_*_x86_64.whl 2>/dev/null | head -n1 || true)"
if [[ ! -f "$x86" ]]; then
echo "Copying arm wheel as is (missing x86 component): $arm"
mv "$arm" "$OUT_DIR"
continue
fi
echo "Merging:"
echo " ARM: $arm"
echo " X86: $x86"
delocate-merge "$arm" "$x86" -w "$OUT_DIR"
rm "$x86"
done
for x86 in *x86_64.whl; do
echo "Copying x86_64 wheel as is (missing arm component): $x86"
mv "$x86" "$OUT_DIR"
done

- name: Sanity check - install and test a single universal2 wheel
env:
# Pip now forces us to either make a venv or set this flag, so we will do
# this
PIP_BREAK_SYSTEM_PACKAGES: 1
SDL_VIDEODRIVER: "dummy"
SDL_AUDIODRIVER: "disk"
run: |
python3 -m pip install --no-index --find-links wheelhouse pygame-ce
python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300

- uses: actions/upload-artifact@v6
with:
name: pygame-wheels-macos
path: ./wheelhouse/*.whl
compression-level: 0 # wheels are already zip files, no need for more compression
1 change: 1 addition & 0 deletions .github/workflows/release-gh-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
uses: actions/download-artifact@v7
with:
path: pygame-wheels
pattern: pygame-wheels-*
merge-multiple: true

# Strips 'release/' from the ref_name, this helps us access the version
Expand Down
Loading