Modernize packaging and CI (pyproject.toml, Tox, GHA) #7
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: Pipeline | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
env: | |
- lint | |
- format | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- run: pip install tox | |
- run: tox run -e ${{ matrix.env }} | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: pip install tox | |
- run: tox run -e py | |
publish: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- check | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install build tools | |
run: pip install tox | |
- name: Verify package version is same as Git tag | |
run: tox run -qe ensure_version_matches -- $GIT_TAG | |
env: | |
GIT_TAG: ${{ github.ref_name }} | |
- name: Build package and upload to PyPI | |
run: tox run -e package -- upload | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |