Skip to content

Build_macOS_arm64

Build_macOS_arm64 #29

Workflow file for this run

name: Build_macOS_arm64
on: workflow_dispatch #[push, pull_request]
jobs:
build_macOS_arm64:
runs-on: macos-15
env:
_PYTHON_HOST_PLATFORM: "macosx-15.0-arm64"
ARCHFLAGS: "-arch arm64"
MACOSX_DEPLOYMENT_TARGET: "15.0"
CPPFLAGS: "-I/usr/local/include"
LDFLAGS: "-L/usr/local/lib"
strategy:
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
steps:
- name: Check architecture
run: uname -m && arch
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
brew install fontconfig freetype jpeg-turbo libpng xz glfw libdeflate
brew install meson ninja
python -m pip install build wheel delocate meson-python cython
python -m pip install numpy pysam
bash ci/osx-build-deps
- name: Checkout gw
run: |
git submodule init
git submodule update
cd gw
git checkout master
git branch
cd ../
- name: Build gw submodule
run: |
cd ./gw
make prep > /dev/null 2>&1
CPPFLAGS+="-I$(brew --prefix)/include" LDFLAGS+="-L$(brew --prefix)/lib" make shared -j3
echo "LibGW compiled"
cp libgw/*.* $(brew --prefix)/lib
cp libgw/libskia.a ../gwplot/
cp -rf libgw/GW $(brew --prefix)/include
cd ..
ls $(brew --prefix)/include/GW
ls -lh $(brew --prefix)/lib/libgw*
ls -lh $(brew --prefix)/lib/libskia.a
ls -lh ./gwplot
- name: Build wheel file
run: |
CPPFLAGS+="-I$(brew --prefix)/include -I$(brew --prefix)/include/GW" LDFLAGS+="-L$(brew --prefix)/lib" pip wheel . --wheel-dir dist
- name: Delocate wheel file
run: |
DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$(brew --prefix)/lib" delocate-wheel --require-archs arm64 -w dist -v dist/*.whl
- name: Install and test wheel
run: |
mkdir -p test_env
cd test_env
cp ../dist/gwplot*.whl .
python -m wheel unpack gwplot*.whl --dest wheel_contents
echo "Unpacked wheel contents:"
ls -Ra wheel_contents
echo "Checking interface.so dependencies:"
otool -L wheel_contents/gwplot-*/gwplot/interface.*.so
echo "Checking libgw dependencies:"
otool -L wheel_contents/gwplot-*/gwplot/.dylibs/libgw.*dylib
PYTHON_VERSION=${{ matrix.python-version }}
PYTHON_VERSION_NO_DOT=$(echo $PYTHON_VERSION | tr -d '.')
python${PYTHON_VERSION} -m venv .venv
source .venv/bin/activate
python -m pip install *cp${PYTHON_VERSION_NO_DOT}*.whl
python -c "import gwplot"
- name: Archive wheel files
uses: actions/upload-artifact@v4
with:
name: wheels_macOS_arm64_py${{ matrix.python-version }}
path: dist/gwplot*.whl