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
65 changes: 55 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,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
Comment on lines +164 to +166
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Replace --force with --force-reinstall in the pip install command.

The --force flag is not a valid pip option. There isn't a built-in force flag for pip install. The correct flag is --force-reinstall.

-          python3 -m pip install --no-index --force --find-links wheelhouse pygame-ce
+          python3 -m pip install --no-index --force-reinstall --find-links wheelhouse pygame-ce
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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
run: |
python3 -m pip install --no-index --force-reinstall --find-links wheelhouse pygame-ce
python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300
🤖 Prompt for AI Agents
In .github/workflows/build-macos.yml around lines 164 to 166, the pip install
command uses the invalid flag "--force"; replace it with the correct pip option
"--force-reinstall" so the line reads the same except using --force-reinstall
(keeping --no-index and --find-links wheelhouse pygame-ce) to ensure packages
are reinstalled properly during the workflow run.


- 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