Skip to content

Add support for apple silicon #146

Add support for apple silicon

Add support for apple silicon #146

Workflow file for this run

name: Wheel builder
on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types:
- published
jobs:
build_wheels:
name: Build wheel for ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
matrix:
buildplat:
# should also be able to do multi-archs on a single entry, e.g.
# [windows-2019, win*, "AMD64 x86"]. However, those two require a different compiler setup
# so easier to separate out here.
# Not supported for now
# - [ubuntu-22.04, musllinux, x86_64]
# - [windows-2019, win, AMD64]
- [macos-12, macosx, arm64]
# working
# - [ubuntu-22.04, manylinux, x86_64]
# - [macos-11, macosx, x86_64]
# python: [ ["cp38", "3.8"],["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11.0-alpha - 3.11.0"]]
python: [["cp310", "3.10"]]
env:
IS_32_BIT: ${{ matrix.buildplat[2] == 'x86' }}
steps:
- name: Checkout pyAVL
uses: actions/checkout@v3
# Used to host cibuildwheel
- uses: actions/[email protected]
with:
python-version: 3.9
- name: win_amd64 - install rtools
if: ${{ runner.os == 'Windows' && env.IS_32_BIT == 'false' }}
run: |
# mingw-w64
choco install rtools --no-progress
echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}*
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS
CIBW_BEFORE_BUILD_MACOS: "bash {project}/tools/wheels/cibw_before_build_macos.sh {project}"
CIBW_ENVIRONMENT: >
MACOSX_DEPLOYMENT_TARGET=12.0
_PYTHON_HOST_PLATFORM="macosx-12.0-arm64"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
DYLD_LIBRARY_PATH=/usr/local/gfortran/lib:/opt/arm64-builds/lib delocate-listdeps {wheel} &&
DYLD_LIBRARY_PATH=/usr/local/gfortran/lib:/opt/arm64-builds/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
PKG_CONFIG_PATH: /opt/arm64-builds/lib/pkgconfig
# assumes that the cmake config is in /usr/local/lib/cmake
CMAKE_PREFIX_PATH: /opt/arm64-builds/
REPAIR_PATH: /usr/local/gfortran/lib:/opt/arm64-builds/lib
- uses: actions/upload-artifact@v3
name: upload the wheels
with:
path: ./wheelhouse/*.whl
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
upload_all:
name: upload the wheels to PYPI
needs: [build_wheels]
runs-on: ubuntu-latest
steps:
- name: what is going on
run: pwd & ls -R
- name: Checkout pyAVL
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
id: download
name: download the wheels
with:
path: wheelhouse
- name: 'Echo download path'
run: echo ${{steps.download.outputs.download-path}}
- name: Display structure of downloaded files
run: ls -R
- name: make dist dir
run: mkdir dist
- name: Move wheels to dist
run: bash tools/wheels/move_wheels.sh
# - name: Publish distribution 📦 to Test PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# # packages-dir: wheelhouse/
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository-url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
# packages-dir: wheelhouse/
password: ${{ secrets.PYPI_API_TOKEN }}