Upload package to Pypi #78
Workflow file for this run
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: Upload package to Pypi | |
on: | |
workflow_dispatch: | |
inputs: | |
overrideVersion: | |
description: Manually force a version | |
env: | |
CIBW_BUILD_VERBOSITY: 3 | |
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.overrideVersion }} | |
# Run the package tests using `pytest` | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: pytest {project}/tests | |
jobs: | |
make_sdist: | |
name: Make SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install deps | |
run: python -m pip install build twine | |
- name: Build SDist | |
run: python -m build --sdist | |
- uses: actions/upload-artifact@v2 | |
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@v2 | |
# Used to host cibuildwheel | |
- uses: actions/setup-python@v2 | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir wheelhouse | |
env: | |
# Disable explicitly building PyPI wheels for specific configurations | |
CIBW_SKIP: pp* cp{38,39,310,311,312}-manylinux_i686 *-musllinux_* cp{38,39,310,311,312}-win32 | |
CIBW_PRERELEASE_PYTHONS: False | |
# Manually force a version (and avoid building local wheels) | |
CIBW_ENVIRONMENT: "SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.overrideVersion }}" | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: wheelhouse/*.whl | |
build_aarch64_wheels: | |
name: Build wheels manylinux_aarch64 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: [36, 37, 38, 39, 310, 311, 312] | |
include: | |
- os: ubuntu-latest | |
arch: aarch64 | |
platform_id: manylinux_aarch64 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- 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 }} | |
# Manually force a version (and avoid building local wheels) | |
CIBW_ENVIRONMENT: "SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.overrideVersion }}" | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: wheelhouse/*.whl | |
upload_all: | |
needs: [build_wheels, build_aarch64_wheels, make_sdist] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: ${{ secrets.PYPI_USERNAME }} | |
password: ${{ secrets.PYPI_PASSWORD }} | |