Skip to content

MACos Wheel

MACos Wheel #21

Workflow file for this run

name: MACos Wheel
on: [push, pull_request]
jobs:
macos:
# On MACOS 13+, user 'runner' is not part of wheel group.
# Hence, we need to use sudo everywhere.
# Moreover, installed Python is 'universal2', this leads to packages
# being mistakenly built as 'universal2' instead of 'x86_64'/'arm64'.
# This confuses the heck out of 'delocate-wheel' which we need to patch
# to make it work.
runs-on: ${{ matrix.PLATFORM.RUNNER }}
strategy:
matrix:
PYTHON: ['3.9', '3.10', '3.11', '3.12', '3.13']
PLATFORM:
- { NAME: "Intel", ARCHITECTURE: "x86_64", RUNNER: "macos-13" }
- { NAME: "Silicon", ARCHITECTURE: "arm64", RUNNER: "macos-14" }
env:
ARCHFLAGS: "-arch ${{ matrix.PLATFORM.ARCHITECTURE }}"
MACOSX_DEPLOYMENT_TARGET: "11.0"
name: "${{ matrix.PYTHON }} - ${{ matrix.PLATFORM.NAME }}"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.PYTHON }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade cffi wheel delocate pytest setuptools build
- name: Build CLIPSPy
run: |
export PY_PLATFORM=$(python -c "import sysconfig; print('%s' % sysconfig.get_platform());")
export _PYTHON_HOST_PLATFORM="${PY_PLATFORM/universal2/${{ matrix.PLATFORM.ARCHITECTURE }}}"
sudo --preserve-env make clipspy
- name: Install CLIPSPy
run: |
pip install dist/*.whl
- name: Run tests
run: |
# Run test from outside module to test installed package
cd ../
python -m pytest -v clipspy/test
- name: Store build artifacts
uses: actions/upload-artifact@v4
with:
name: macos-build-${{ matrix.PYTHON }}-${{ matrix.PLATFORM.ARCHITECTURE }}
path: dist
macos-universal:
# Merge MACOS 'x86_64' and 'arm64' into 'universal2' for most recent versions of Python.
needs: [macos]
runs-on: macos-14
strategy:
matrix:
PYTHON: ['cp39-cp39', 'cp310-cp310', 'cp311-cp311', 'cp312-cp312', 'cp313-cp313']
steps:
- uses: actions/download-artifact@v4
with:
pattern: macos-build-*
path: artifacts/
merge-multiple: true
- name: Set up Python 3.13
uses: actions/setup-python@v2
with:
python-version: 3.13
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade wheel delocate setuptools
- name: Run delocate fuse onto the wheels
run: |
mkdir -p dist
# Can't understand why globbing does not work in here
delocate-merge artifacts/clipspy-1.0.5-${{ matrix.PYTHON }}-macosx_11_0_arm64.whl artifacts/clipspy-1.0.5-${{ matrix.PYTHON }}-macosx_11_0_x86_64.whl -w dist/
- name: Store build artifacts
uses: actions/upload-artifact@v4
with:
name: macos-universal-${{ matrix.PYTHON }}
path: dist/
macos-build:
needs: [macos-universal]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: macos-universal-*
path: artifacts
merge-multiple: true
- name: Store build artifacts
uses: actions/upload-artifact@v4
with:
name: macos-build
path: artifacts/*universal2*.whl