2021-03-25 20:55:33 +00:00
|
|
|
name: Upload to PyPI
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
overrideVersion:
|
|
|
|
description: Manually force a version
|
|
|
|
|
|
|
|
env:
|
|
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
|
|
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.overrideVersion }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
make_sdist:
|
|
|
|
name: Make SDist
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout the repository
|
2024-09-03 19:19:03 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-03-25 20:55:33 +00:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
- name: Setup Python
|
2024-09-03 19:19:03 +00:00
|
|
|
uses: actions/setup-python@v5
|
2021-03-25 20:55:33 +00:00
|
|
|
with:
|
|
|
|
python-version: '3.8'
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install build twine
|
|
|
|
- name: Build SDist
|
|
|
|
run: |
|
|
|
|
python -m build --sdist
|
|
|
|
- name: Put SDist in artifact container
|
2024-09-03 19:19:03 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2021-03-25 20:55:33 +00:00
|
|
|
with:
|
|
|
|
path: dist/*.tar.gz
|
|
|
|
- name: Check SDist 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]
|
|
|
|
bitness: [32, 64]
|
2024-09-03 19:19:03 +00:00
|
|
|
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
2021-03-25 20:55:33 +00:00
|
|
|
include:
|
|
|
|
- os: windows-latest
|
|
|
|
bitness: 64
|
|
|
|
platform_id: win_amd64
|
|
|
|
- os: windows-latest
|
|
|
|
bitness: 32
|
|
|
|
platform_id: win32
|
|
|
|
- os: ubuntu-latest
|
|
|
|
bitness: 64
|
|
|
|
platform_id: manylinux_x86_64
|
|
|
|
- os: ubuntu-latest
|
|
|
|
bitness: 32
|
|
|
|
platform_id: manylinux_i686
|
|
|
|
- os: macos-latest
|
|
|
|
bitness: 64
|
|
|
|
platform_id: macosx_x86_64
|
|
|
|
exclude:
|
|
|
|
- os: macos-latest
|
|
|
|
bitness: 32
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2024-09-03 19:19:03 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-03-25 20:55:33 +00:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
- name: Get Python Version Name
|
2024-09-03 19:19:03 +00:00
|
|
|
uses: mad9000/actions-find-and-replace-string@5
|
2021-03-25 20:55:33 +00:00
|
|
|
id: pythonversion
|
|
|
|
with:
|
|
|
|
source: ${{ matrix.python }}
|
|
|
|
find: '.'
|
|
|
|
replace: ''
|
|
|
|
- name: Build wheels
|
2024-09-03 19:19:03 +00:00
|
|
|
uses: joerick/cibuildwheel@v2.20.0
|
2021-03-25 20:55:33 +00:00
|
|
|
env:
|
|
|
|
CIBW_BUILD: cp${{ steps.pythonversion.outputs.value }}-${{ matrix.platform_id }}
|
|
|
|
CIBW_ENVIRONMENT: "SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.overrideVersion }}"
|
|
|
|
- name: Upload wheels to artifact container
|
2024-09-03 19:19:03 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2021-03-25 20:55:33 +00:00
|
|
|
with:
|
|
|
|
path: wheelhouse/*.whl
|
|
|
|
|
|
|
|
upload_all:
|
|
|
|
needs: [build_wheels, make_sdist]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Get SDist and wheels from artifact container
|
2024-09-03 19:19:03 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2021-03-25 20:55:33 +00:00
|
|
|
with:
|
|
|
|
name: artifact
|
|
|
|
path: dist
|
|
|
|
- name: Publish wheels to Test PyPI
|
2024-09-03 19:19:03 +00:00
|
|
|
uses: pypa/gh-action-pypi-publish@v1.10.1
|
2021-03-25 20:55:33 +00:00
|
|
|
with:
|
|
|
|
user: ${{ secrets.PYPI_USERNAME }}
|
|
|
|
password: ${{ secrets.PYPI_PASSWORD }}
|