Skip to content

Add mypy & type annotations. #126

Add mypy & type annotations.

Add mypy & type annotations. #126

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
django-version: ["3.2", "4.0", "4.1", "4.2", "5.0"]
exclude:
# Python 3.11 is not supported until Django 4.1
- python-version: "3.11"
django-version: "3.2"
- python-version: "3.11"
django-version: "4.0"
# Python 3.12 is not supported until Django 4.2
- python-version: "3.12"
django-version: "3.2"
- python-version: "3.12"
django-version: "4.0"
- python-version: "3.12"
django-version: "4.1"
# Python <3.10 is not supported by Django 5.0+
- python-version: "3.8"
django-version: "5.0"
- python-version: "3.9"
django-version: "5.0"
services:
postgres:
image: postgres:12
env:
POSTGRES_USER: test-pg-user
POSTGRES_PASSWORD: test-pg-pass
POSTGRES_DB: devdatatestdb
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_USER: test-pg-user
POSTGRES_PASSWORD: test-pg-pass
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: abatilo/actions-poetry@v2.1.5
with:
poetry-version: 1.7.1
- name: Set up dependencies
run: poetry install
- name: Test
run: poetry run tox
env:
django-version: ${{ matrix.django-version }}
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Set up Poetry
uses: abatilo/actions-poetry@v2.1.5
with:
poetry-version: 1.7.1
- name: Install dependencies
run: |
poetry install
- name: Lint
run: |
poetry run flake8 . --jobs=auto --format=github
type-check:
name: Type-check
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Set up Poetry
uses: abatilo/actions-poetry@v2.1.5
with:
poetry-version: 1.7.1
- name: Install dependencies
run: |
poetry install
- name: Type-check
run: |
poetry run mypy src tests
validate-dependencies:
name: Check dependency locks
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Set up Poetry
uses: abatilo/actions-poetry@v2.1.5
with:
poetry-version: 1.7.1
- uses: PeterJCLaw/validate-generated-files@v1
with:
command: poetry lock --no-update
files: poetry.lock