Initial commit #2
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 & Checks | |
on: [push, pull_request] | |
jobs: | |
tests: | |
name: Tests & Checks | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{matrix.python}} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Check with linters | |
run: tox -e lint | |
- name: Test with tox | |
run: tox -e py | |
build-and-publish: | |
name: Build a new package and publish it to pypi if necessary | |
runs-on: ubuntu-latest | |
needs: tests | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: python -m build | |
- name: upload windows dists | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release-dists | |
path: dist/ | |
- name: Publish release distributions to PyPI | |
# deploy only when a new tag is pushed to github | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 |