Fix Python 3.12 #438
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, test and upload to PyPI | |
on: | |
push: | |
branches: | |
- master | |
- 1.0.X | |
- 1.1.X | |
tags: | |
- v* | |
pull_request: | |
types: [opened, reopened] | |
jobs: | |
build_wheels: | |
name: Build and test wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
env: | |
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* | |
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64" | |
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_x86_64 *-musllinux_i686" | |
CIBW_BEFORE_TEST: pip install -r {package}/requirements-dev.txt | |
CIBW_TEST_COMMAND: python -m pytest {package}/tests --benchmark-skip | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Fetch all history for all tags and branches | |
run: | | |
git fetch --prune --unshallow | |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '3.9' | |
- name: Install cibuildwheel | |
run: | | |
python -m pip install cibuildwheel==2.16.2 | |
- name: Build wheels | |
run: | | |
python -m cibuildwheel --output-dir wheelhouse | |
- 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: Fetch all history for all tags and branches | |
run: | | |
git fetch --prune --unshallow | |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: "3.9" | |
- name: Install requirements | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build | |
- name: Build sdist | |
run: | | |
python -m build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
build_docs: | |
name: Build and deploy documentation | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
strategy: | |
fail-fast: true | |
matrix: | |
branch: [1.1.X] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ matrix.branch }} | |
- name: Fetch all branches | |
run: | | |
git fetch --prune --unshallow | |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: List tags | |
run: git tag | |
- name: List current branch | |
run: git branch --show-current | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: "3.9" | |
- name: Install requirements | |
run: | | |
sudo apt-get install graphviz pandoc | |
python -m pip install --upgrade pip | |
python -m pip install -r docs/requirements.txt | |
- name: Install current version | |
run: pip install . | |
- name: Build docmentation | |
run: | | |
mkdir html | |
python -I -m sphinx docs html | |
- name: Deploy documentation | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./html | |
destination_dir: ${{ matrix.branch }} | |
upload_pypi: | |
name: Upload artifacts to PyPI | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |