Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update risk matrix #101

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 59 additions & 84 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,92 +1,67 @@
name: CI
name: Test

on:
pull_request:
push:
branches:
- 'master'
tags:
- '*'
on: [push, pull_request]

jobs:
build:

name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:

- name: Python 3.9 / Django 2.2
python_version: "3.9"
tox_env: py39-django22

- name: Python 3.9 / Django 3.0
python_version: "3.9"
tox_env: py39-django30

- name: Python 3.9 / Django 3.1
python_version: "3.9"
tox_env: py39-django31

- name: Python 3.7 / Django 3.2
python_version: "3.7"
tox_env: py37-django32

- name: Python 3.8 / Django 3.2
python_version: "3.8"
tox_env: py38-django32

- name: Python 3.9 / Django 3.2
python_version: "3.9"
tox_env: py39-django32

- name: Python 3.10 / Django 3.2
python_version: "3.10"
tox_env: py310-django32

- name: Python 3.9 / Django 4.0
python_version: "3.9"
tox_env: py39-django40

- name: Docs
python_version: "3"
tox_env: docs

- name: Lint
python_version: "3"
tox_env: lint

name: "${{ matrix.name }}"
runs-on: ubuntu-latest
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
django-version: ['4.2', '5.0', 'main']
exclude:
# Django 5.0 dropped support for Python <3.10
- django-version: '5.0'
python-version: '3.8'
- django-version: '5.0'
python-version: '3.9'
- django-version: 'main'
python-version: '3.8'
- django-version: 'main'
python-version: '3.9'

steps:
- uses: actions/checkout@v2

- name: Set up Python
id: setup-python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}

- name: Pip cache
uses: actions/cache@v2
with:
path: |
~/.cache/
key: ${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('setup.cfg') }}

- name: Install Tox
run: pip install tox

- name: Run ${{ matrix.name }}
run: tox
env:
TOXENV: "${{ matrix.tox_env }}"

report-status:
name: success
runs-on: ubuntu-latest
needs: build
steps:

- name: Report success
run: echo 'Success !'
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"

- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ matrix.python-version }}-v1-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions

- name: Set Path
run: |
PWD=$(pwd)
export PYTHONPATH=$PWD/:$PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV

- name: Tox tests
run: |
tox -v
env:
DJANGO: ${{ matrix.django-version }}

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: Python ${{ matrix.python-version }}
2 changes: 1 addition & 1 deletion demo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import unicode_literals

DEBUG = True

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
ADMINS = (("Some Admin", "some_admin@example.com"),)

MANAGERS = ADMINS
Expand Down
38 changes: 29 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
[tox]
envlist =
py{37,38,39}-django{22,30,31}
py{37,38,39,310}-django{32}
py{38,39,310}-django{40}
py{38,39,310,311,312}-dj42
py{310,311,312}-dj{50,main}
lint
docs

[gh-actions]
python =
3.8: py38, lint, sphinx, readme
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[gh-actions:env]
DJANGO =
4.2: dj42
5.0: dj50
main: djmain

[testenv]
usedevelop = True
extras = dev
deps =
django22: Django==2.2.*
django30: Django==3.0.*
django31: Django==3.1.*
django32: Django==3.2.*
django40: Django==4.0.*
dj42: Django>=4.2,<5.0
dj50: Django>=5.0,<5.1
djmain: https://github.com/django/django/archive/main.tar.gz
commands =
pytest {posargs}
ignore_outcome =
djmain: True

[testenv:lint]
deps =
flake8
black
isort
commands =
isort --check --diff mail_factory demo
isort --check --recursive --diff mail_factory demo
flake8 mail_factory demo --show-source
black --check mail_factory demo

Expand All @@ -35,3 +52,6 @@ commands =
commands =
isort mail_factory demo
black mail_factory demo

[pytest]
DJANGO_SETTINGS_MODULE = demo.settings
Loading