Skip to content

Add pull request validation workflow (#1) #6

Add pull request validation workflow (#1)

Add pull request validation workflow (#1) #6

Workflow file for this run

name: Run pull request validation
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
run-checks:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- python-version: "3.10"
- python-version: "3.11"
- python-version: "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: |
python -m pip install poetry==1.8.2
- name: Configure poetry
run: |
python -m poetry config virtualenvs.in-project true
- name: Cache the virtualenv
id: poetry-dependencies-cache
uses: actions/cache@v3
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dev dependencies
if: steps.poetry-dependencies-cache.outputs.cache-hit != 'true'
run: |
python -m poetry install
- name: Check for formatting issues
run: python -m poetry run black --check --diff .
- name: Check for linting issues
run: python -m poetry run ruff check .
- name: Run static type analysis
run: python -m poetry run mypy .
- name: Test with tox
run: |
source .venv/bin/activate
coverage erase
tox run-parallel -f py${{ matrix.python-version }} --parallel-no-spinner --parallel-live
coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true