diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 781ea04069..63090df723 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -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 }} @@ -122,6 +114,59 @@ 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 + + - name: Generate universal2 wheels + run: | + set -euo pipefail + shopt -s nullglob + + pipx install delocate + + 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 --force --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 diff --git a/.github/workflows/release-gh-draft.yml b/.github/workflows/release-gh-draft.yml index 55f0102292..babbdb929f 100644 --- a/.github/workflows/release-gh-draft.yml +++ b/.github/workflows/release-gh-draft.yml @@ -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