-
Notifications
You must be signed in to change notification settings - Fork 110
105 lines (95 loc) · 2.99 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: "Tests"
on:
push:
branches: [ develop ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]
schedule:
- cron: '30 22 15 * *'
jobs:
pytest:
name: pytest
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
django: ['2.2', '3.0', '3.1', '3.2', '4.0', '4.1', '4.2', '5.0']
database: ['postgres', 'sqlite']
exclude:
- python: '3.8'
django: '5.0'
- python: '3.9'
django: '5.0'
- python: '3.10'
django: '2.2'
- python: '3.10'
django: '3.0'
- python: '3.10'
django: '3.1'
- python: '3.11'
django: '2.0'
- python: '3.11'
django: '2.1'
- python: '3.11'
django: '2.2'
- python: '3.11'
django: '3.0'
- python: '3.11'
django: '3.1'
- python: '3.11'
django: '3.2'
- python: '3.11'
django: '4.0'
- python: '3.12'
django: '2.2'
- python: '3.12'
django: '3.0'
- python: '3.12'
django: '3.1'
- python: '3.12'
django: '3.2'
- python: '3.12'
django: '4.0'
- python: '3.12'
django: '4.1'
services:
# as far as I can see, no way to make this conditional on the matrix database
postgres:
image: postgres:12
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dirtyfields_test
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install test requirements
run: |
python -m pip install --upgrade pip wheel
pip install django~=${{ matrix.django }}.0 coverage[toml]~=7.0 -r tests-requirements.txt
python --version
pip list
- name: Run unit tests
run: coverage run -m pytest -v
env:
TEST_DATABASE: ${{ matrix.database }}
# Run tests on original source code, rather than installing the package into the python environment.
# This ensures coverage report has files listed with paths relative to the repository root.
PYTHONPATH: './src'
- name: Report coverage to console
run: coverage report
- name: Create XML coverage report for coveralls.io
if: ${{ matrix.django == '4.2' && matrix.python == '3.10' && matrix.database == 'postgres' }}
run: coverage xml
- name: Upload coverage report to coveralls.io
if: ${{ matrix.django == '4.2' && matrix.python == '3.10' && matrix.database == 'postgres' }}
uses: coverallsapp/github-action@v2
with:
file: coverage.xml