Build wheel #39
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 wheel | |
on: | |
workflow_dispatch: | |
push: | |
# Pattern matched against refs/tags | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
env: | |
CIBW_BUILD_VERBOSITY: 1 | |
# Run the package tests using `pytest` | |
# CIBW_TEST_REQUIRES: pytest | |
# CIBW_TEST_COMMAND: pytest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
make_sdist: | |
name: Make SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Install deps | |
run: python -m pip install build twine | |
- name: Build SDist | |
run: python -m build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
- name: Check metadata | |
run: twine check dist/* | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
# Used to host cibuildwheel | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir wheelhouse | |
env: | |
# Disable building PyPy wheels | |
CIBW_SKIP: "pp* cp313* cp312*i686" | |
CIBW_ARCHS_MACOS: "x86_64 arm64" | |
CIBW_PRERELEASE_PYTHONS: False | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: wheelhouse/*.whl | |
build_aarch64_wheels: | |
name: Build wheels manylinux_aarch64 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: [37, 38, 39, 310, 311, 312] | |
include: | |
- os: ubuntu-latest | |
arch: aarch64 | |
platform_id: manylinux_aarch64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_ARCHS_LINUX: ${{matrix.arch}} | |
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: wheelhouse/*.whl | |
upload_pypi: | |
name: Upload to PyPI (prod) | |
needs: [build_wheels, build_aarch64_wheels, make_sdist] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |