Add support for Python 3.11 and 3.12 #93
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: Test and Publish | |
on: | |
push: | |
pull_request: | |
branches: [develop] | |
jobs: | |
test-code: | |
name: Test code | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[tests] tox-gh-actions | |
- name: Test with Tox | |
run: tox | |
test-docs: | |
name: Test documentation | |
runs-on: ubuntu-latest | |
env: | |
PYTHON_VERSION: '3.x' | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[docs] | |
- name: Build documentation | |
working-directory: docs | |
run: make html | |
publish-to-test-pypi: | |
name: Publish to TestPyPI | |
environment: staging | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
needs: | |
- test-code | |
- test-docs | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade setuptools wheel twine build | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: '__token__' | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
python -m build | |
twine upload --repository testpypi dist/* | |
publish-to-pypi: | |
name: Publish to PyPI | |
environment: production | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
needs: publish-to-test-pypi | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade setuptools wheel twine build | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: '__token__' | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
python -m build | |
twine upload dist/* |