chore: update pre-commit hooks (#186) #530
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: Unit testing, formatting & linting | |
on: [push] | |
jobs: | |
linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Cache multiple paths | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/pre-commit | |
key: ${{ runner.os }}-3.11-${{ hashFiles('**/.pre-commit-config.yaml') }} | |
- run: pip install pre-commit~=2.20 | |
- run: pre-commit run -a | |
testing: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.ref_name }}-${{ matrix.python-version }} | |
cancel-in-progress: true | |
strategy: | |
matrix: | |
python-version: | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache multiple Pips | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
.venv | |
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- run: pip install poetry~=1.3 | |
- run: poetry config virtualenvs.in-project true | |
- 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@v4 | |
with: | |
python-version: "3.10" | |
- name: Cache Pip | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
.venv | |
key: ${{ runner.os }}-3.10-${{ hashFiles('**/poetry.lock') }} | |
- run: pip install poetry~=1.2 | |
- 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 }} |