Skip to content

Improve CDIST.

Improve CDIST. #463

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:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
pyver: [cp38, cp39, cp310, cp311, cp312]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_BUILD: ${{matrix.pyver}}-*
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
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- 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:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'push' && ${{ !startsWith(github.ref, 'refs/tags/v') }}
strategy:
fail-fast: false
max-parallel: 1
matrix:
branch: [master, 1.1.X, 1.0.X]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ matrix.branch }}
- 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 --force-reinstall .
pip install -r requirements-dev.txt
- 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:
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 }}