Skip to content

Update testing versions #84

Update testing versions

Update testing versions #84

Workflow file for this run

name: Python unit tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
postgres-version: ["9.6", "10", "11", "12", "13", "14", "15"]
django-version: ["1.8", "1.9", "1.10", "1.11", "2.0", "2.1", "2.2", "3.0", "3.1", "3.2", "4.0", "4.1", "4.2"]
exclude:
# Django 3.0+ doesn't support python 3.5
- python-version: "3.5"
django-version: "3.0"
- python-version: "3.5"
django-version: "3.1"
- python-version: "3.5"
django-version: "3.2"
- python-version: "3.5"
django-version: "4.0"
- python-version: "3.5"
django-version: "4.1"
- python-version: "3.5"
django-version: "4.2"
# Django 4.0+ doesn't support python 3.6, 3.7
- python-version: "3.6"
django-version: "4.0"
- python-version: "3.7"
django-version: "4.0"
- python-version: "3.7"
django-version: "4.1"
- python-version: "3.7"
django-version: "4.2"
# Django 4.0+ doesn't support PostgreSQL 9.6
- django-version: "4.0"
postgres-version: "9.6"
- django-version: "4.1"
postgres-version: "9.6"
- django-version: "4.2"
postgres-version: "9.6"
# python 3.6+ has deprecated issue with django before 1.11
# https://stackoverflow.com/questions/41343263/provide-classcell-example-for-python-3-6-metaclass\
- python-version: "3.6"
django-version: "1.8"
- python-version: "3.6"
django-version: "1.9"
- python-version: "3.6"
django-version: "1.10"
- python-version: "3.7"
django-version: "1.8"
- python-version: "3.7"
django-version: "1.9"
- python-version: "3.7"
django-version: "1.10"
- python-version: "3.8"
django-version: "1.8"
- python-version: "3.8"
django-version: "1.9"
- python-version: "3.8"
django-version: "1.10"
- python-version: "3.9"
django-version: "1.8"
- python-version: "3.9"
django-version: "1.9"
- python-version: "3.9"
django-version: "1.10"
- python-version: "3.10"
django-version: "1.8"
- python-version: "3.10"
django-version: "1.9"
- python-version: "3.10"
django-version: "1.10"
- python-version: "3.11"
django-version: "1.8"
- python-version: "3.11"
django-version: "1.9"
- python-version: "3.11"
django-version: "1.10"
- python-version: "3.12"
django-version: "1.8"
- python-version: "3.12"
django-version: "1.9"
- python-version: "3.12"
django-version: "1.10"
# Django before 2.1 is not compatible with python 3.10
# as it uses collections.Iterator
- python-version: "3.10"
django-version: "2.0"
- python-version: "3.10"
django-version: "1.11"
- python-version: "3.11"
django-version: "2.0"
- python-version: "3.11"
django-version: "1.11"
- python-version: "3.12"
django-version: "2.0"
- python-version: "3.12"
django-version: "1.11"
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-test.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install pip dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install -r requirements-test.txt
python -m pip install -U django==${{ matrix.django-version }}.*
python setup.py -q install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --extend-exclude=build/
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Set up test databases
run: |
psql -tc 'SHOW server_version' -U postgres -h localhost
psql -c 'CREATE ROLE test;' -U postgres -h localhost
psql -c 'ALTER ROLE test WITH SUPERUSER;' -U postgres -h localhost
psql -c 'ALTER ROLE test WITH LOGIN;' -U postgres -h localhost
psql -c "ALTER ROLE test PASSWORD 'test';" -U postgres -h localhost
psql -c 'CREATE DATABASE test OWNER test;' -U postgres -h localhost
env:
PGPASSWORD: postgres
- name: Test with unittest
run: |
python runtests.py