-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a special action to upload version-limited Mac-ARM wheels
For 1.3.2 we built on x86 Mac (macos-13) but it would be good to have (and test) some ARM wheels as well. We're having trouble building those on older Python versions, but if we upload 3.10 and 3.11 wheels to PyPI that should be somewhat useful. This action is not intended to stick around once py3.8 and 3.9 are deprecated; then we will try to build intel and ARM wheels in the same job.
- Loading branch information
Showing
1 changed file
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Build and upload PyPI wheels for ARM Mac | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [macos-latest] | ||
python-version: ['3.10', '3.11'] | ||
include: | ||
- os: macos-latest | ||
wheelname: macos | ||
# Build wheels against the lowest compatible Numpy version | ||
- python-version: 3.10 | ||
numpy-version: 1.21.3 | ||
- python-version: 3.11 | ||
numpy-version: 1.23.2 | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Ensure tags are fetched for versioning | ||
- name: Setup Python ${{ matrix.python-version }} with Conda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
channels: conda-forge,defaults | ||
channel-priority: true | ||
- name: Update Python pip, wheel, and twine | ||
shell: bash -l {0} | ||
run: | | ||
python -m pip install --upgrade pip wheel twine | ||
- name: Install llvm on Macos | ||
if: startsWith(matrix.os, 'macos') | ||
run: brew install llvm | ||
|
||
- name: Build Python wheel | ||
|
||
if: matrix.os != 'ubuntu-latest' | ||
shell: bash -l {0} | ||
env: | ||
NUMPY_VERSION: ${{ matrix.numpy-version }} | ||
run: | | ||
# Build against lowest required Numpy version | ||
python -m pip install numpy==${NUMPY_VERSION} | ||
python -m pip wheel . -w wheelhouse --no-deps | ||
- name: Upload wheels as build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheel-${{ matrix.wheelname }}-${{ matrix.python-version }} | ||
path: wheelhouse/*-${{ matrix.wheelname }}*.whl | ||
|
||
publish: | ||
needs: build | ||
name: Upload release to PyPI | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/euphonic | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # This is possibly unnecessary? | ||
|
||
- name: Download artifacts to Ubuntu environment | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist/ | ||
merge-multiple: true | ||
|
||
- name: List Files | ||
run: ls -R | ||
|
||
- name: Upload wheels to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |