Skip to content

Pydantic V2 full support + massive refactoring #462

Pydantic V2 full support + massive refactoring

Pydantic V2 full support + massive refactoring #462

Workflow file for this run

name: Python testing
on:
push:
branches:
- main
- dev-3.x
paths:
- ".github/workflows/testing.yml"
- "fastapi_jsonapi/**"
- "tests/**"
- "codecov.yaml"
- "pyproject.toml"
pull_request:
branches:
- main
- dev-3.x
paths:
- ".github/workflows/testing.yml"
- "fastapi_jsonapi/**"
- "tests/**"
- "pyproject.toml"
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: python -m pip install --upgrade pip pre-commit hatch
- name: Install dependencies
run: hatch env create
- name: Lint code
run: pre-commit run --all-files
run-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
db-url:
- "sqlite+aiosqlite:///./db.sqlite3"
- "postgresql+asyncpg://user:passwd@localhost:5432/app"
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: passwd
POSTGRES_DB: app
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: ♿ Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: 🔨 Build package
run: python -m build
- name: Test with pytest and coverage through hatch
run: hatch run test.py${{ matrix.python-version }}:cov-xml -v
env:
TESTING_DB_URL: ${{ matrix.db-url }}
- name: Upload coverage data to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/${{ matrix.python-version }}/coverage.xml
flags: unittests
name: py-${{ matrix.python-version }}-db-${{ startsWith(matrix.db-url, 'sqlite') && 'sqlite' || startsWith(matrix.db-url, 'postgres') && 'postgres' || 'unknown' }}
fail_ci_if_error: true