add pyproject.toml and tox to make testing simpler #77
Workflow file for this run
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: django-cte tests | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ['3.7', '3.8', '3.9', '3.10'] | |
django: | |
- 'Django>=2.2,<3.0' | |
- 'Django>=3.0,<3.1' | |
- 'Django>=3.1,<3.2' | |
- 'Django>=3.2,<3.3' | |
- 'Django>=4.0,<4.1' | |
- 'Django>=4.1,<4.2' | |
experimental: [false] | |
include: | |
- python: '3.10' | |
django: 'https://github.com/django/django/archive/refs/heads/main.zip#egg=Django' | |
experimental: true | |
# NOTE this job will appear to pass even when it fails because of | |
# `continue-on-error: true`. Github Actions apparently does not | |
# have this feature, similar to Travis' allow-failure, yet. | |
# https://github.com/actions/toolkit/issues/399 | |
exclude: | |
- python: '3.7' | |
django: 'Django>=4.0,<4.1' | |
- python: '3.7' | |
django: 'Django>=4.1,<4.2' | |
- python: '3.10' | |
django: 'Django>=2.2,<3.0' | |
- python: '3.10' | |
django: 'Django>=3.0,<3.1' | |
- python: '3.10' | |
django: 'Django>=3.1,<3.2' | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_DB: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions flake8 | |
- name: Run Tox tests | |
env: | |
DB_SETTINGS: >- | |
{ | |
"ENGINE":"django.db.backends.postgresql_psycopg2", | |
"NAME":"django_cte", | |
"USER":"postgres", | |
"PASSWORD":"postgres", | |
"HOST":"localhost", | |
"PORT":"5432" | |
} | |
DJANGO: ${{ matrix.django }} | |
run: tox | |
continue-on-error: ${{ matrix.experimental }} | |
- name: Check style | |
# flake8 3.8.3 needs importlib-metadata < 5 | |
# https://github.com/python/importlib_metadata/issues/406 | |
run: | | |
pip install "importlib-metadata<5" | |
flake8 django_cte/ tests/ |