Merge pull request #9 from JWCook/tests #20
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 & Publish | |
on: | |
push: | |
branches: [master] | |
tags: ['v*'] | |
pull_request: | |
branches: [master] | |
jobs: | |
# For all PRs and commits to main, run tests for each supported python version | |
# Note: This is currently expected to fail due to output variations based on | |
# dependency versions | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install -U pip setuptools | |
pip install -e .[dev] | |
- name: Run tests | |
run: pytest -vs tests | |
# For git tags, build and publish package to PyPI | |
publish: | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Build package distributions | |
run: | | |
pip install hatch | |
hatch build | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |