mirror of https://github.com/KLayout/klayout.git
Enabling M1 runners for Python package building inside github actions
This commit is contained in:
parent
cfe00d4f1c
commit
1cf7abacca
|
|
@ -20,8 +20,12 @@ jobs:
|
|||
max-parallel: 12
|
||||
matrix:
|
||||
include:
|
||||
- os: "macos-latest"
|
||||
- os: "macos-13" # intel runner
|
||||
cibuild: "*macosx*"
|
||||
macos-arch: "x86_64"
|
||||
- os: "macos-14" # M1 runner
|
||||
cibuild: "*macosx*"
|
||||
macos-arch: "arm64"
|
||||
- os: "ubuntu-latest"
|
||||
cibuild: "*manylinux*"
|
||||
- os: "ubuntu-latest"
|
||||
|
|
@ -58,6 +62,7 @@ jobs:
|
|||
# CIBW_SOME_OPTION: value
|
||||
env:
|
||||
CIBW_BUILD: ${{ matrix.cibuild }}
|
||||
CIBW_ARCHS_MACOS: ${{ matrix.macos-arch }}
|
||||
|
||||
- name: Download Cache from Docker (linux only)
|
||||
if: ${{ runner.os == 'Linux' }}
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
# Solves issue #1346
|
||||
# Deprecate patch when Github Actions provides Apple Silicon runners.
|
||||
# WARNING: Only run this in a CI runner
|
||||
|
||||
# Issue: klayout depends on libpng, which is loaded by homebrew.
|
||||
# But M1 wheels are cross-compiled in an intel host, so by default
|
||||
# libpng.dylib has an x86 architecture. This prevents linking the library
|
||||
# in the tl library.
|
||||
|
||||
# Patch solution: manually download libpng arm64 pre-built library from homebrew
|
||||
|
||||
# Reading
|
||||
# https://stackoverflow.com/questions/55110564/how-can-i-install-a-homebrew-bottle-designed-for-a-different-previous-version
|
||||
# https://github.com/Homebrew/homebrew-core/blob/6abea16e917b12d6af4912736f66eb8d42bf089b/Formula/libpng.rb
|
||||
|
||||
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
||||
|
||||
# Check if we're about to build an arm64 wheel. WARNING universal wheels not supported
|
||||
if [ "$_PYTHON_HOST_PLATFORM" == "macosx-11.0-arm64" ]
|
||||
then
|
||||
# Exit early if done
|
||||
test -f /tmp/libpng-apple-silicon-installed && exit 0
|
||||
curl -L -H "Authorization: Bearer QQ==" -o /tmp/libpng-1.6.39.arm64_big_sur.bottle.1.tar.gz https://ghcr.io/v2/homebrew/core/libpng/blobs/sha256:cf59cedc91afc6f2f3377567ba82b99b97744c60925a5d1df6ecf923fdb2f234
|
||||
brew reinstall -f /tmp/libpng-1.6.39.arm64_big_sur.bottle.1.tar.gz || exit 1
|
||||
touch /tmp/libpng-apple-silicon-installed
|
||||
elif [ -f "/tmp/libpng-apple-silicon-installed" ]; then
|
||||
brew reinstall -f libpng && rm -f /tmp/libpng-apple-silicon-installed
|
||||
fi
|
||||
|
|
@ -11,9 +11,6 @@ test-command = [
|
|||
# Disable building PyPy wheels on all platforms
|
||||
skip = "pp*"
|
||||
|
||||
# Skip trying to test arm64 builds on Intel Macs
|
||||
test-skip = "*-macosx_arm64 *-macosx_universal2:arm64"
|
||||
|
||||
[tool.cibuildwheel.linux]
|
||||
# beware: the before-all script does not persist environment variables!
|
||||
# No point in defining $PATH or $CCACHE_DIR
|
||||
|
|
@ -27,17 +24,5 @@ before-build = "ccache -s"
|
|||
environment-pass = ["HOST_CCACHE_DIR"]
|
||||
|
||||
[tool.cibuildwheel.macos]
|
||||
before-all = [
|
||||
"brew install libpng",
|
||||
"brew deps --tree --installed",
|
||||
]
|
||||
|
||||
# TEMP while Github Actions does not provide an Apple Silicon runner
|
||||
# TODO Simply remove it when it's available
|
||||
archs = ["x86_64", "arm64"]
|
||||
before-build = [
|
||||
"ccache -s",
|
||||
"bash {project}/ci-scripts/macos/libpng-patch.sh",
|
||||
]
|
||||
# Repair macOS wheels (include libpng with the wheel, for example)
|
||||
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v --ignore-missing-dependencies {wheel}"
|
||||
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v --ignore-missing-dependencies {wheel}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue