Skip to content

Bump gh actions mac runners (gets us native M1 builds) #2494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 8, 2024
Merged
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- run:
name: Build the Linux wheels.
command: |
pip3 install --user cibuildwheel==2.16.4
pip3 install --user cibuildwheel==2.17.0
PATH="$HOME/.local/bin:$PATH" cibuildwheel --output-dir wheelhouse

- store_artifacts:
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ concurrency:
jobs:
deps:
name: ${{ matrix.macarch }} deps
runs-on: macos-12
runs-on: ${{ matrix.os }}
strategy:
matrix:
# make arm64 deps and x86_64 deps
macarch: [arm64, x86_64]
include:
- { macarch: arm64, os: macos-14 }
- { macarch: x86_64, os: macos-13 }

steps:
- uses: actions/[email protected]
Expand All @@ -54,7 +56,7 @@ jobs:
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 }}
key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-${{ matrix.macarch }}-${{ matrix.os }}
lookup-only: true

# build mac deps on cache miss
Expand All @@ -76,7 +78,7 @@ jobs:
build:
name: ${{ matrix.name }}
needs: deps
runs-on: macos-12
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # if a particular matrix build fails, don't skip the rest
matrix:
Expand All @@ -87,31 +89,36 @@ jobs:
- {
name: "x86_64 (CPython 3.9 - 3.12)",
macarch: x86_64,
os: macos-13,
pyversions: "cp3{9,10,11,12}-*",
}

- {
name: "x86_64 (Python 3.8)",
macarch: x86_64,
os: macos-13,
# CPython/PyPy 3.8
pyversions: "?p38-*",
}

- {
name: "x86_64 (PyPy 3.9 and 3.10)",
macarch: x86_64,
os: macos-13,
pyversions: "pp39-* pp310-*",
}

- {
name: "arm64 (CPython 3.8 - 3.10)",
macarch: arm64,
os: macos-14,
pyversions: "cp3{8,9,10}-*",
}

- {
name: "arm64 (CPython 3.11 - 3.12)",
macarch: arm64,
os: macos-14,
pyversions: "cp3{11,12}-*",
}

Expand All @@ -135,8 +142,6 @@ jobs:

CIBW_BUILD: ${{ matrix.pyversions }}

# Build arm64 and x86_64 wheels too on an Intel runner.
# Note that the arm64 wheels cannot be tested on CI in this configuration
CIBW_ARCHS: ${{ matrix.macarch }}

# Setup macOS dependencies
Expand Down Expand Up @@ -177,7 +182,7 @@ jobs:
fail-on-cache-miss: true

- name: Build and test wheels
uses: pypa/cibuildwheel@v2.16.4
uses: pypa/cibuildwheel@v2.17.0

- uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
CIBW_MANYLINUX_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}
CIBW_MANYLINUX_PYPY_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}

uses: pypa/cibuildwheel@v2.16.4
uses: pypa/cibuildwheel@v2.17.0

# We upload the generated files under github actions assets
- name: Upload dist
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
arch: ${{ matrix.msvc-dev-arch }}

- name: Build and test wheels
uses: pypa/cibuildwheel@v2.16.5
uses: pypa/cibuildwheel@v2.17.0

- uses: actions/upload-artifact@v4
with:
Expand Down
3 changes: 1 addition & 2 deletions buildconfig/macdependencies/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ It deletes some homebrew files, and messes with /usr/local/.

Warning: *do not run on your own machine*.

It tries to work as far back as Mac OSX 10.9, for x64 and arm64 (cross compiled)
architectures.
It tries to work as far back as Mac OSX 10.11, for x64 and arm64 architectures.

If there needs to be separate configure options between linux and mac
then something like the following can be used.
Expand Down
14 changes: 2 additions & 12 deletions buildconfig/macdependencies/build_mac_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,8 @@ export PG_BASE_MESON_FLAGS="--prefix=$PG_DEP_PREFIX \
-Ddefault_library=shared"

if [[ "$MAC_ARCH" == "arm64" ]]; then
# for scripts using ./configure to make arm64 binaries
export CC="clang -target arm64-apple-macos11.0"
export CXX="clang++ -target arm64-apple-macos11.0"

# This does not do anything actually, but without this ./configure errors
export PG_BASE_CONFIGURE_FLAGS="$PG_BASE_CONFIGURE_FLAGS --host=aarch64-apple-darwin20.0.0"

# configure cmake to cross-compile
export PG_BASE_CMAKE_FLAGS="$PG_BASE_CMAKE_FLAGS -DCMAKE_OSX_ARCHITECTURES=arm64"

# configure meson to cross-compile
export PG_BASE_MESON_FLAGS="$PG_BASE_MESON_FLAGS --cross-file $(pwd)/macos_arm64.ini"
# needs native-file that has correct macosx deployment target
export PG_BASE_MESON_FLAGS="$PG_BASE_MESON_FLAGS --native-file $(pwd)/macos_arm64.ini"

# we don't need mac 10.9 support while compiling for apple M1 macs
export MACOSX_DEPLOYMENT_TARGET=11.0
Expand Down
26 changes: 13 additions & 13 deletions buildconfig/macdependencies/clean_usr_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
# First clean up some homebrew stuff we don't want linked in
# ----------------------------------------------------------

rm -rf /usr/local/bin/curl
rm -rf /usr/local/opt/curl
rm -rf /usr/local/bin/git
rm -rf /usr/local/opt/git
rm -rf /usr/local/bin/curl /usr/local/opt/curl /opt/homebrew/bin/curl
rm -rf /usr/local/bin/git /usr/local/opt/git /opt/homebrew/bin/git
# Use the apple provided curl, and git.
# The homebrew ones depend on libs we don't want to include.
# ln -s /usr/bin/curl /usr/local/bin/curl
ln -s /usr/bin/git /usr/local/bin/git
ln -s /usr/bin/git /opt/homebrew/bin/git

rm -rf /usr/local/lib/libtiff*
rm -rf /usr/local/lib/libzstd*
Expand All @@ -23,16 +22,17 @@ rm -rf /usr/local/lib/libgthread*
rm -rf /usr/local/lib/libintl*
rm -rf /usr/local/lib/libbrotlidec*
rm -rf /usr/local/lib/libopus*
rm -rf /usr/local/opt/freetype
rm -rf /usr/local/lib/freetype*
rm -rf /usr/local/opt/freetype*

rm -rf /usr/local/Cellar/libtiff
rm -rf /usr/local/Cellar/libsndfile
rm -rf /usr/local/Cellar/glib
rm -rf /usr/local/Cellar/brotli
rm -rf /usr/local/Cellar/pcre*
rm -rf /usr/local/Cellar/opusfile
rm -rf /usr/local/Cellar/opus
rm -rf /usr/local/Cellar/freetype
rm -rf /usr/local/Cellar/libtiff /opt/homebrew/Cellar/libtiff
rm -rf /usr/local/Cellar/libsndfile /opt/homebrew/Cellar/libsndfile
rm -rf /usr/local/Cellar/glib /opt/homebrew/Cellar/glib
rm -rf /usr/local/Cellar/brotli /opt/homebrew/Cellar/brotli
rm -rf /usr/local/Cellar/pcre* /opt/homebrew/Cellar/pcre*
rm -rf /usr/local/Cellar/opusfile /opt/homebrew/Cellar/opusfile
rm -rf /usr/local/Cellar/opus /opt/homebrew/Cellar/opus
rm -rf /usr/local/Cellar/freetype* /opt/homebrew/Cellar/freetype*

rm -rf /usr/local/share/doc/tiff-*
rm -rf /usr/local/share/doc/libsndfile
Expand Down
23 changes: 8 additions & 15 deletions buildconfig/macdependencies/macos_arm64.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
[constants]
macos_ver = ['-mmacosx-version-min=11.0']
macos_arch = ['-arch', 'arm64']

[host_machine]
system = 'darwin'
cpu_family = 'aarch64'
cpu = 'arm64'
endian = 'little'

[binaries]
c = ['clang']
Expand All @@ -18,11 +11,11 @@ strip = ['strip']
pkgconfig = ['pkg-config']

[built-in options]
c_args = macos_arch + macos_ver
cpp_args = macos_arch + macos_ver + ['-stdlib=libc++']
objc_args = macos_arch + macos_ver
objcpp_args = macos_arch + macos_ver + ['-stdlib=libc++']
c_link_args = macos_arch + macos_ver
cpp_link_args = macos_arch + macos_ver
objc_link_args = macos_arch + macos_ver
objcpp_link_args = macos_arch + macos_ver
c_args = macos_ver
cpp_args = macos_ver + ['-stdlib=libc++']
objc_args = macos_ver
objcpp_args = macos_ver + ['-stdlib=libc++']
c_link_args = macos_ver
cpp_link_args = macos_ver
objc_link_args = macos_ver
objcpp_link_args = macos_ver
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ cd $(dirname `readlink -f "$0"`)
# separate build script for it

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
export PG_LINUX_EXTRA_FLAGS="--user"
export PG_PIP_EXTRA_FLAGS="--user"
elif [[ "$OSTYPE" == "darwin"* ]]; then
export PG_PIP_EXTRA_FLAGS="--break-system-packages"
fi

# pin versions for stability (remember to keep updated)
python3 -m pip install $PG_LINUX_EXTRA_FLAGS \
python3 -m pip install $PG_PIP_EXTRA_FLAGS \
setuptools==68.2.2 cmake==3.27.6 meson==1.2.2 ninja==1.11.1

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tar xf ${GLIB}.tar
cd $GLIB

# a minimal glib install will do for us
meson setup _build $PG_BASE_MESON_FLAGS -Dtests=false \
meson setup _build $PG_BASE_MESON_FLAGS --force-fallback-for libpcre2-8 -Dtests=false \
-Dselinux=disabled -Dlibmount=disabled -Ddtrace=false -Dsystemtap=false -Dnls=disabled

meson compile -C _build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e -x

cd $(dirname `readlink -f "$0"`)

WAVPACK_VERSION=5.6.0
WAVPACK_VERSION=5.7.0
WAVPACK="wavpack-${WAVPACK_VERSION}"

curl -sL --retry 10 https://github.com/dbry/WavPack/releases/download/${WAVPACK_VERSION}/${WAVPACK}.tar.xz > ${WAVPACK}.tar.xz
Expand All @@ -12,13 +12,7 @@ sha512sum -c wavpack.sha512
tar xf ${WAVPACK}.tar.xz
cd ${WAVPACK}

if [[ "$MAC_ARCH" == "arm64" ]]; then
# As of now, wavpack builds fail on arm64 cross compilation when ASM
# optimisations are enabled, so disable it
export WAVPACK_EXTRA_M1_FLAGS="-DWAVPACK_ENABLE_ASM=OFF"
fi

cmake . $PG_BASE_CMAKE_FLAGS $WAVPACK_EXTRA_M1_FLAGS
cmake . $PG_BASE_CMAKE_FLAGS

make
make install
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7421eff1f6e18f2e698b367ca48f6773456d0fcb53241be70149a87eff2cdf14dd8a82845a016f59ed32c7df494d018e6e23495709d3a56500b0660f177d5c0f wavpack-5.6.0.tar.xz
63ef6eb5ff71bf6417175691e8377624ade02619c761d80e265c8e0e7305bfe22eeaa1402e36d20c13d20847279f95150ac014019688389da1b87b86558446bd wavpack-5.7.0.tar.xz
Loading