Bump actions/cache from 4.1.1 to 4.1.2 #4597
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: macOS | |
# Run CI only when a release is created, on changes to main branch, or any PR | |
# to main. Do not run CI on any other branch. Also, skip any non-source changes | |
# from running on CI | |
on: | |
push: | |
branches: main | |
paths-ignore: | |
- 'docs/**' | |
- 'examples/**' | |
- '.gitignore' | |
- '*.rst' | |
- '*.md' | |
- '.github/workflows/*.yml' | |
# re-include current file to not be excluded | |
- '!.github/workflows/build-macos.yml' | |
pull_request: | |
branches: main | |
paths-ignore: | |
- 'docs/**' | |
- 'examples/**' | |
- '.gitignore' | |
- '*.rst' | |
- '*.md' | |
- '.github/workflows/*.yml' | |
# re-include current file to not be excluded | |
- '!.github/workflows/build-macos.yml' | |
# the github release drafter can call this workflow | |
workflow_call: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-macos | |
cancel-in-progress: true | |
jobs: | |
deps: | |
name: ${{ matrix.macarch }} deps | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# make arm64 deps and x86_64 deps | |
include: | |
- { macarch: arm64, os: macos-14 } | |
- { macarch: x86_64, os: macos-13 } | |
steps: | |
- uses: actions/[email protected] | |
- name: Test for Mac Deps cache hit | |
id: macdep-cache | |
uses: actions/[email protected] | |
with: | |
path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} | |
# The hash of all files in buildconfig manylinux-build and macdependencies is | |
# the key to the cache. If anything changes here, the deps are built again | |
key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-${{ matrix.macarch }}-${{ matrix.os }} | |
lookup-only: true | |
# build mac deps on cache miss | |
- name: Build Mac Deps | |
if: steps.macdep-cache.outputs.cache-hit != 'true' | |
run: | | |
export MAC_ARCH="${{ matrix.macarch }}" | |
brew install coreutils pkg-config | |
cd buildconfig/macdependencies | |
bash ./build_mac_deps.sh | |
# Uncomment when you want to manually verify the deps by downloading them | |
# - name: Upload Mac deps | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: pygame-mac-deps-${{ matrix.macarch }} | |
# path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} | |
build: | |
name: ${{ matrix.macarch }} | |
needs: deps | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false # if a particular matrix build fails, don't skip the rest | |
matrix: | |
include: | |
- { macarch: arm64, os: macos-14 } | |
- { macarch: x86_64, os: macos-13 } | |
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 | |
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macarch == 'x86_64' && '10.11' || '11.0' }} | |
CIBW_ARCHS: ${{ matrix.macarch }} | |
# Setup macOS dependencies | |
CIBW_BEFORE_ALL: | | |
brew install pkg-config | |
cd buildconfig/macdependencies | |
cp -r ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} ${{ github.workspace }}/pygame_mac_deps | |
bash ./install_mac_deps.sh | |
CIBW_BEFORE_BUILD: | | |
cp -r ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} ${{ github.workspace }}/pygame_mac_deps | |
# To remove any speculations about the wheel not being self-contained | |
CIBW_BEFORE_TEST: rm -rf ${{ github.workspace }}/pygame_mac_deps | |
steps: | |
- uses: actions/[email protected] | |
- name: pip cache | |
uses: actions/[email protected] | |
with: | |
path: ~/Library/Caches/pip # This cache path is only right on mac | |
key: pip-cache-${{ matrix.macarch }}-${{ matrix.os }} | |
- name: Fetch Mac deps | |
id: macdep-cache | |
uses: actions/[email protected] | |
with: | |
path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} | |
key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-${{ matrix.macarch }} | |
fail-on-cache-miss: true | |
- name: Install uv for speed | |
uses: yezz123/setup-uv@v4 | |
with: | |
uv-version: "0.4.10" | |
- name: Build and test wheels | |
uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pygame-wheels-macos-${{ matrix.macarch }} | |
path: ./wheelhouse/*.whl | |
compression-level: 0 # wheels are already zip files, no need for more compression |