add osx arm build; gha workflows use 'latest' tags #32
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
name: Build and upload to PyPI | |
# Build on every branch push, tag push, and pull request change: | |
on: [push, pull_request] | |
# Alternatively, to publish when a (published) GitHub Release is created, use the following: | |
# on: | |
# push: | |
# pull_request: | |
# release: | |
# types: | |
# - published | |
env: | |
CIBW_BUILD_VERBOSITY: 3 | |
CIBW_TEST_COMMAND: python -m unittest discover {project}/tests | |
# Disable building PyPy wheels on all platforms | |
CIBW_SKIP: pp* | |
# The windows builds was reusing the found win32 dll instead of downloading the win64 one. | |
# Additionally, the build directory contained the prior win32 dll. Easier to delete it, too. | |
CIBW_BEFORE_BUILD_WINDOWS: del /q {project}\parasail\parasail.dll | |
# automake is not included in the stock macos runner, which triggers `setup.py` to install all deps (not just | |
# the missing ones). However, the newly installed m4 binary fails on macos with a SIGABRT (though the original | |
# `brew` installed one does not) as documented in: | |
# https://github.com/jeffdaily/parasail-python/issues/24. | |
CIBW_BEFORE_BUILD_MACOS: brew install automake | |
jobs: | |
build_wheels: | |
name: Build wheels for ${{ matrix.python }}-${{ matrix.buildplat[1] }} | |
runs-on: ${{ matrix.buildplat[0] }} | |
strategy: | |
# Ensure that a wheel builder finishes even if another fails | |
fail-fast: false | |
matrix: | |
buildplat: | |
- [ubuntu-latest, manylinux_x86_64] | |
- [ubuntu-latest, musllinux_i686] | |
- [ubuntu-latest, manylinux_x86_64] | |
- [ubuntu-latest, musllinux_i686] | |
- [windows-latest, win_amd64] | |
- [windows-latest, win32] | |
- [macos-latest, macosx_x86_64] | |
- [macos-latest, macosx_arm64] | |
# we only need to build for a single python version since the wheels are universal | |
python: ["cp38"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.9.0 | |
env: | |
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
# upload to PyPI on every tag starting with 'v' | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
# alternatively, to publish when a GitHub Release is created, use the following rule: | |
# if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1.5.0 | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
# To test: repository_url: https://test.pypi.org/legacy/ |