Skip to content

Commit 14642b6

Browse files
committed
Update CI rules
1 parent 0030a1c commit 14642b6

File tree

2 files changed

+62
-84
lines changed

2 files changed

+62
-84
lines changed

.github/workflows/ci.yml

+59-84
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,67 @@
1-
name: CI
1+
name: Test
22

3-
on:
4-
pull_request:
5-
push:
6-
branches:
7-
- 'master'
8-
tags:
9-
- '*'
3+
on: [push, pull_request]
104

115
jobs:
126
build:
13-
7+
name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }})
8+
runs-on: ubuntu-latest
149
strategy:
10+
fail-fast: false
1511
matrix:
16-
include:
17-
18-
- name: Python 3.9 / Django 2.2
19-
python_version: "3.9"
20-
tox_env: py39-django22
21-
22-
- name: Python 3.9 / Django 3.0
23-
python_version: "3.9"
24-
tox_env: py39-django30
25-
26-
- name: Python 3.9 / Django 3.1
27-
python_version: "3.9"
28-
tox_env: py39-django31
29-
30-
- name: Python 3.7 / Django 3.2
31-
python_version: "3.7"
32-
tox_env: py37-django32
33-
34-
- name: Python 3.8 / Django 3.2
35-
python_version: "3.8"
36-
tox_env: py38-django32
37-
38-
- name: Python 3.9 / Django 3.2
39-
python_version: "3.9"
40-
tox_env: py39-django32
41-
42-
- name: Python 3.10 / Django 3.2
43-
python_version: "3.10"
44-
tox_env: py310-django32
45-
46-
- name: Python 3.9 / Django 4.0
47-
python_version: "3.9"
48-
tox_env: py39-django40
49-
50-
- name: Docs
51-
python_version: "3"
52-
tox_env: docs
53-
54-
- name: Lint
55-
python_version: "3"
56-
tox_env: lint
57-
58-
name: "${{ matrix.name }}"
59-
runs-on: ubuntu-latest
12+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
13+
django-version: ['4.2', '5.0', 'main']
14+
exclude:
15+
# Django 5.0 dropped support for Python <3.10
16+
- django-version: '5.0'
17+
python-version: '3.8'
18+
- django-version: '5.0'
19+
python-version: '3.9'
20+
- django-version: 'main'
21+
python-version: '3.8'
22+
- django-version: 'main'
23+
python-version: '3.9'
6024

6125
steps:
62-
- uses: actions/checkout@v2
63-
64-
- name: Set up Python
65-
id: setup-python
66-
uses: actions/setup-python@v2
67-
with:
68-
python-version: ${{ matrix.python_version }}
69-
70-
- name: Pip cache
71-
uses: actions/cache@v2
72-
with:
73-
path: |
74-
~/.cache/
75-
key: ${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('setup.cfg') }}
76-
77-
- name: Install Tox
78-
run: pip install tox
79-
80-
- name: Run ${{ matrix.name }}
81-
run: tox
82-
env:
83-
TOXENV: "${{ matrix.tox_env }}"
84-
85-
report-status:
86-
name: success
87-
runs-on: ubuntu-latest
88-
needs: build
89-
steps:
90-
91-
- name: Report success
92-
run: echo 'Success !'
26+
- uses: actions/checkout@v2
27+
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v2
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
33+
- name: Get pip cache dir
34+
id: pip-cache
35+
run: |
36+
echo "::set-output name=dir::$(pip cache dir)"
37+
38+
- name: Cache
39+
uses: actions/cache@v2
40+
with:
41+
path: ${{ steps.pip-cache.outputs.dir }}
42+
key:
43+
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}
44+
restore-keys: |
45+
${{ matrix.python-version }}-v1-
46+
47+
- name: Install dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
python -m pip install --upgrade tox tox-gh-actions
51+
52+
- name: Set Path
53+
run: |
54+
PWD=$(pwd)
55+
export PYTHONPATH=$PWD/:$PYTHONPATH
56+
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
57+
58+
- name: Tox tests
59+
run: |
60+
tox -v
61+
env:
62+
DJANGO: ${{ matrix.django-version }}
63+
64+
- name: Upload coverage
65+
uses: codecov/codecov-action@v1
66+
with:
67+
name: Python ${{ matrix.python-version }}

tox.ini

+3
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ commands =
5252
commands =
5353
isort mail_factory demo
5454
black mail_factory demo
55+
56+
[pytest]
57+
DJANGO_SETTINGS_MODULE = demo.settings

0 commit comments

Comments
 (0)