Skip to content

Use result instead of exceptions #598

Use result instead of exceptions

Use result instead of exceptions #598

Workflow file for this run

name: Unit testing, formatting & linting
on:
- push
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Cache multiple paths
uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.cache/pre-commit
key: ${{ runner.os }}-3.9-${{ hashFiles('**/.pre-commit-config.yaml') }}
- run: pip install -U pre-commit
- run: pre-commit run -a
testing:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "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: Cache multiple Pips
uses: actions/cache@v4
with:
path: |
~/.cache/pip
.venv
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- run: pip install -U poetry
- run: poetry install --sync
- run: make test
- run: make mypy
publish_package:
runs-on: ubuntu-latest
needs:
- testing
- linting
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Cache Pip
uses: actions/cache@v4
with:
path: |
~/.cache/pip
.venv
key: ${{ runner.os }}-3.9-${{ hashFiles('**/poetry.lock') }}
- run: pip install poetry
- run: poetry build
# From https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi-and-testpypi
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}