Skip to content

Wheel-Builder

Wheel-Builder #93

Workflow file for this run

---
name: Build and Upload Wheels
on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
repository:
description: 'The repository to upload the package to'
required: true
default: 'none'
type: choice
options:
- none
- testpypi
- pypi
cibw_skip:
description: 'The CIBW_SKIP env for cibuildwheels'
required: true
default: cp38-win_arm64
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}_${{ matrix.archs }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
archs: [x86_64, i686, aarch64, ppc64le, s390x]
build: [manylinux, musllinux]
include:
- os: windows-2022
archs: AMD64
- os: windows-2022
archs: x86
- os: windows-2022
archs: ARM64
- os: macOS-13
archs: x86_64
- os: macOS-13
archs: arm64
- os: macOS-13
archs: universal2
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse
env:
CIBW_BUILD: "{cp38,cp39,cp310,cp311,cp312}-${{ matrix.build }}*"
CIBW_SKIP: ${{ github.event.inputs.cibw_skip }}
CIBW_ARCHS: ${{ matrix.archs }}
CIBW_BUILD_FRONTEND: 'build'
CIBW_TEST_REQUIRES: 'pytest'
CIBW_TEST_COMMAND: 'pytest {project}'
# Until the day Apple silicon instances are available on GH Actions
CIBW_TEST_SKIP: '*-win_arm64 *-macosx_arm64'
- uses: actions/upload-artifact@v4
with:
name: Wheel-${{ matrix.os }}-${{ matrix.build }}${{ matrix.archs }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build a source distribution
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Build sdist
run: |
python -m pip install --upgrade pip
pip install setuptools
python setup.py build sdist
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz
publish:
if: github.event.inputs.repository != 'none'
name: 'Upload to PyPI/Test PyPI'
runs-on: ubuntu-22.04
needs: [build_wheels, build_sdist]
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Set up built items
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: 'Publish to TestPyPI'
if: github.event.inputs.repository == 'testpypi'
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
twine upload --repository ${{ github.event.inputs.repository }} dist/*
- name: Publish
if: github.event.inputs.repository == 'pypi'
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload --repository ${{ github.event.inputs.repository }} dist/*