Skip to content

Commit

Permalink
Build M-series (arm64) macOS wheels on GitHub Actions hosted runners (p…
Browse files Browse the repository at this point in the history
…ybamm-team#3789)

* Add configuration for macOS arm64 wheels

See pybamm-team#3772

* Build on Python 3.10+ for now

* Possibly incorrect version string parsing

* Missed adding link for `pybind11`

* pipx invocation is missing, installed by default on other runners

* Add user-facing CHANGELOG entry about M-series wheels

Python 3.8 wheels cannot be tested on arm64 devices but Python 3.9+ wheels can be. It would be a good idea to test all wheels across all Python versions.

* Add `always()` condition to ensure job will run
  • Loading branch information
agriyakhetarpal authored and js1tr3 committed Aug 12, 2024
1 parent f57eb1b commit 50ee8f5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
42 changes: 38 additions & 4 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,45 @@ jobs:
path: ./wheelhouse/*.whl
if-no-files-found: error

- name: Upload wheels for macOS
- name: Upload wheels for macOS amd64
uses: actions/upload-artifact@v4
if: matrix.os == 'macos-latest'
with:
name: macos_wheels
name: macos_amd64_wheels
path: ./wheelhouse/*.whl
if-no-files-found: error

build_macos_arm64_wheels:
name: Wheels (macos-arm64)
# Current runner is macOS X 14+ on GitHub-hosted runners
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Clone pybind11 repo (no history)
run: git clone --depth 1 --branch v2.11.1 https://github.com/pybind/pybind11.git

- name: Install SuiteSparse and SUNDIALS on macOS
run: |
brew install graphviz openblas libomp
brew reinstall gcc
python -m pip install cmake pipx
python scripts/install_KLU_Sundials.py
- name: Build wheels on macOS arm64
run: python -m pipx run cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_BUILD: python -m pip install cmake casadi setuptools wheel delocate
CIBW_REPAIR_WHEEL_COMMAND: delocate-listdeps {wheel} && delocate-wheel -v -w {dest_dir} {wheel}
CIBW_TEST_COMMAND: python -c "import pybamm; pybamm.IDAKLUSolver()"

- name: Upload wheels for macOS arm64
uses: actions/upload-artifact@v4
with:
name: macos_arm64_wheels
path: ./wheelhouse/*.whl
if-no-files-found: error

Expand Down Expand Up @@ -175,7 +209,7 @@ jobs:
publish_pypi:
if: github.event_name != 'schedule' && github.repository_owner == 'pybamm-team'
name: Upload package to PyPI
needs: [build_macos_and_linux_wheels, build_windows_wheels, build_sdist]
needs: [build_macos_and_linux_wheels, build_macos_arm64_wheels, build_windows_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
Expand All @@ -184,7 +218,7 @@ jobs:
- name: Move all package files to files/
run: |
mkdir files
mv windows_wheels/* linux_wheels/* macos_wheels/* sdist/* files/
mv windows_wheels/* linux_wheels/* macos_amd64_wheels/* macos_arm64_wheels/* sdist/* files/
- name: Publish on PyPI
if: github.event.inputs.target == 'pypi' || github.event_name == 'release'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Features

- Added support for macOS arm64 (M-series) platforms. ([#3789](https://github.com/pybamm-team/PyBaMM/pull/3789))
- Renamed "electrode diffusivity" to "particle diffusivity" as a non-breaking change with a deprecation warning ([#3624](https://github.com/pybamm-team/PyBaMM/pull/3624))
- Add support for BPX version 0.4.0 which allows for blended electrodes and user-defined parameters in BPX([#3414](https://github.com/pybamm-team/PyBaMM/pull/3414))
- Added the ability to specify a custom solver tolerance in `get_initial_stoichiometries` and related functions ([#3714](https://github.com/pybamm-team/PyBaMM/pull/3714))
Expand Down

0 comments on commit 50ee8f5

Please sign in to comment.