Skip to content

Add CI build scripts for Arm64 Macs #3

Add CI build scripts for Arm64 Macs

Add CI build scripts for Arm64 Macs #3

name: Build and Publish Wheels (Mac OSX Arm64 only)
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@v2
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