Adding deployment rule for PyPI. Minor updates to documentation #15
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: CI | |
on: [push, pull_request] | |
jobs: | |
lint: | |
# Run for PRs only if they come from a forked repo (avoids duplicate runs) | |
if: >- | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
toxenv: [ruff, docs, twinecheck] | |
steps: | |
- 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 tox | |
- name: Run tox ${{ matrix.toxenv }} | |
run: tox -e ${{ matrix.toxenv }} | |
build: | |
if: >- | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: python -m pip install build | |
- name: Build temporary sdist and wheel | |
run: python -m build | |
test: | |
if: >- | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest] | |
include: | |
- os: macos-13 | |
python-version: "3.10" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- 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 tox | |
- name: Test with tox | |
run: tox -e py | |
deploy: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
needs: [lint, build, test] | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # required for setuptools_scm | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Make sdist | |
run: | | |
python -m pip install build | |
python -m build --sdist | |
ls -l dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@v1.8.7 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |