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
98 changes: 98 additions & 0 deletions .github/workflows/build_arm64_mac_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build and Publish Wheels (Mac OSX Arm64)

on:
workflow_dispatch:
release:
types: [published]
pull_request:
branches:
- "**"
jobs:
build-mac:
name: Mac OSX Arm64 Python ${{ matrix.python-version }} - Build Wheels
runs-on: macos-14
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- python-version: "3.8"
PYTHON_VERSION_CODE: cp38-cp38
PYTHON_VERSION_NUMBER: "3.8"
- python-version: "3.9"
PYTHON_VERSION_CODE: cp39-cp39
PYTHON_VERSION_NUMBER: "3.9"
- python-version: "3.10"
PYTHON_VERSION_CODE: cp310-cp310
PYTHON_VERSION_NUMBER: "3.10"
- python-version: "3.11"
PYTHON_VERSION_CODE: cp311-cp311
PYTHON_VERSION_NUMBER: "3.11"
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Select Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: "arm64"
- name: Set variables
run: |
VER=$(cat ./VERSION.txt)
echo "VERSION=$VER"
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Test environment
run: |
echo "VERSION=${{ env.VERSION }}"
echo "PYTHON_VERSION_CODE=${{ matrix.PYTHON_VERSION_CODE }}"
echo "PYTHON_VERSION_NUMBER=${{ matrix.PYTHON_VERSION_NUMBER }}"
- name: Install pytest, wheel, auditwheel, pybind11-stubgen, numpy and torch
run: python -m pip install pytest wheel auditwheel numpy torch
- name: Install dependencies
run: ci/mac/install_dependencies.sh
- name: Build wheel
run: |
cd ci/mac
./build_wheels_arm64.sh
env:
PYTHON: ${{ matrix.PYTHON }}
ARCHFLAGS: "-arch arm64"
CFLAGS: "-arch arm64"
CXXFLAGS: "-arch arm64"
_PYTHON_HOST_PLATFORM: "macosx-11.0-arm64"
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION_CODE }}
PYTHON_VERSION_NUMBER: ${{ matrix.PYTHON_VERSION_NUMBER }}
DYLD_PRINT_LIBRARIES: 1
- name: Publish artifact
uses: actions/upload-artifact@v4
with:
name: nimblephysics-${{ env.VERSION }}-${{ matrix.PYTHON_VERSION_CODE }}-macosx_11_0_arm64.whl
path: wheelhouse/nimblephysics-${{ env.VERSION }}-${{ matrix.PYTHON_VERSION_CODE }}-macosx_11_0_arm64.whl
# publish:
# name: Publish to PyPI
# runs-on: ubuntu-latest
# needs: [build-mac]
# steps:
# - name: Download artifacts
# uses: actions/download-artifact@v2
# with:
# path: wheelhouse
# - name: Display structure of downloaded files before flattening
# run: ls -R
# working-directory: wheelhouse
# - name: Flatten files
# run: |
# mkdir wheelhouse2
# find wheelhouse -type f -exec mv {} wheelhouse2 \;
# rm -rf wheelhouse
# mv wheelhouse2 wheelhouse
# - name: Display structure of downloaded files after flattening
# run: ls -R
# working-directory: wheelhouse
# - name: Publish package to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1.8
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
# packages_dir: wheelhouse/
# skip_existing: true
# verbose: true
4 changes: 2 additions & 2 deletions .github/workflows/build_x86_mac_wheels.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Build and Publish Wheels (Mac OSX x86_64 only)
name: Build and Publish Wheels (Mac OSX x86_64)

on:
workflow_dispatch:
release:
types: [published]
jobs:
build-mac:
name: Mac OSX Python ${{ matrix.python-version }} - Build Wheels
name: Mac OSX x86_64 Python ${{ matrix.python-version }} - Build Wheels
runs-on: macos-12
strategy:
matrix:
Expand Down
38 changes: 38 additions & 0 deletions ci/mac/build_wheels_arm64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
set -e

export VERSION=$(cat ../../VERSION.txt)

# Find our python paths
export PYTHON_INCLUDE=$(python3-config --includes)
echo "PYTHON_INCLUDE=${PYTHON_INCLUDE}"
export PYTHON_LIB=$(python3-config --libs)
echo "PYTHON_LIB=${PYTHON_LIB}"

pushd ../..

mkdir -p bin
ln -sfn $(which python3) ./bin/python
export PATH=$(pwd)/bin:${PATH}
echo "python=$(which python)"

rm -rf dist/*
rm -rf build/*
# rm -rf wheelhouse/*

# Actually build the code
python setup.py sdist bdist_wheel --plat-name macosx-11.0-arm64

# Install delocate, to bundle dependencies into the wheel
pushd dist
WHEEL_NAME=$(ls *.whl)
echo "WHEEL_NAME=${WHEEL_NAME}"
DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/lib" delocate-wheel -w ../wheelhouse -v --dylibs-only ${WHEEL_NAME}
popd

# Replace the ABI tag with a more general version if needed
# mv wheelhouse/nimblephysics-0.0.2-cp38-cp38-macosx_11_0_arm64.whl wheelhouse/nimblephysics-0.0.2-cp38-abi3-macosx_11_0_arm64.whl

# Actually push the wheel to PyPI
# python3 -m pip install --user --upgrade twine
# python3 -m twine upload --repository pypi wheelhouse/*
4 changes: 2 additions & 2 deletions ci/mac/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ rm -rf libccd
# Install ASSIMP
git clone https://github.com/assimp/assimp.git
pushd assimp
git checkout v5.0.1
git checkout v5.4.3
mkdir build
pushd build
cmake ..
Expand Down Expand Up @@ -240,7 +240,7 @@ PROTOBUF_VERSION="3.14.0"
# brew install xz zlib bzip2

# Install grpc
git clone --recurse-submodules -b v1.33.2 https://github.com/grpc/grpc
git clone --recurse-submodules -b v1.67.0 https://github.com/grpc/grpc
pushd grpc
pushd third_party/protobuf
git checkout v${PROTOBUF_VERSION}
Expand Down
Loading