update testing matrix to Django 5.0, Python 3.12, drop testing for ol… #249
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
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
tests: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
DJANGO_VERSION: ['3.2.*', '4.0.*', '4.1.*', '4.2.*', '5.0.*'] | |
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] | |
exclude: | |
- DJANGO_VERSION: '5.0.*' | |
python-version: '3.7' | |
- DJANGO_VERSION: '4.2.*' | |
python-version: '3.7' | |
- DJANGO_VERSION: '4.1.*' | |
python-version: '3.7' | |
- DJANGO_VERSION: '4.0.*' | |
python-version: '3.12' | |
- DJANGO_VERSION: '4.0.*' | |
python-version: '3.11' | |
- DJANGO_VERSION: '4.0.*' | |
python-version: '3.7' | |
- DJANGO_VERSION: '3.2.*' | |
python-version: '3.12' | |
- DJANGO_VERSION: '3.2.*' | |
python-version: '3.11' | |
fail-fast: false | |
services: | |
postgres: | |
image: postgres | |
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 }} | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ hashFiles('setup.py') }}-${{ hashFiles('demo/requirements.txt') }}-${{ matrix.DJANGO_VERSION }} | |
- name: Install | |
run: | | |
pip install -q -e . | |
pip install -q --upgrade --upgrade-strategy eager -r demo/requirements.txt | |
pip install -q Django==${{ matrix.DJANGO_VERSION }} | |
pip install codecov | |
- name: Run migration check | |
run: | | |
OUTPUT=$(python demo/manage.py makemigrations --dry-run plans) | |
echo $OUTPUT | grep "No changes detected" &>/dev/null && | |
echo "SUCCESS: Migrations check successful!" || | |
{ | |
echo $OUTPUT | |
echo "ERROR: Migrations check failed! Models' changes not migrated, please run './manage.py makemigrations' to solve the issue!" 1>&2; | |
FAILURE=1 | |
} | |
- name: Testing | |
run: | | |
# Run tests for sample app used for testing extensibility | |
PYTHONPATH="." MANAGE_PY_PATH="demo/manage.py" SAMPLE_APP=1 demo/manage.py test example | |
case "${{ matrix.DJANGO_VERSION }},${{ matrix.python-version }}" in | |
3.2.*,3.7|4.0.*,3.8|4.0.*,3.9|4.0.*,3.10) # Django runs with warnings in this python version | |
PYTHONPATH="." MANAGE_PY_PATH="demo/manage.py" coverage run demo/manage.py test plans | |
;; | |
*) | |
PYTHONPATH="." MANAGE_PY_PATH="demo/manage.py" PYTHONWARNINGS="error::DeprecationWarning" coverage run demo/manage.py test plans | |
;; | |
esac | |
coverage xml && codecov | |
env: | |
POSTGRES_HOST: postgres | |
POSTGRES_PORT: 5432 | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install | |
run: pip install flake8 isort black | |
- name: Running Flake8 | |
run: flake8 | |
- name: Running isort | |
run: isort | |
- name: Running black | |
run: black --check . |