-
Notifications
You must be signed in to change notification settings - Fork 485
188 lines (171 loc) · 4.64 KB
/
workflow.yaml
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: Tests
on:
push:
branches:
- main
paths:
- '**.py'
- '**.txt'
- '**.yaml'
- '**.toml'
pull_request:
branches:
- main
paths:
- '**.py'
- '**.txt'
- '**.toml'
- '**.yaml'
env:
GITHUB_WORKFLOW: true
jobs:
test:
name: Test
runs-on: ubuntu-latest
# test matrix
strategy:
fail-fast: false
matrix:
python:
- 3.8
- 3.9
- "3.10"
- 3.11
- 3.12
django:
- 3.2
- 4.0
- 4.1
- 4.2
- 5.0
- 5.1
database:
- sqlite
- mysql
- postgres
exclude:
# django 3.2
- python: 3.11
django: 3.2
- python: 3.12
django: 3.2
# django 4.0
- python: 3.11
django: 4.0
- python: 3.12
django: 4.0
# django 4.1
- python: 3.12
django: 4.1
# django 5.0
- python: 3.8
django: 5.0
- python: 3.9
django: 5.0
# django 5.1
- python: 3.8
django: 5.1
- python: 3.9
django: 5.1
# additional service containers to run
services:
# postgres service
postgres:
# docker hub image
image: postgres:13-alpine
# configure the instance
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# set health checks to wait until service has started
options: >-
--health-cmd="pg_isready"
--health-interval=10s
--health-timeout=5s
--health-retries=5
# mysql service
mysql:
# docker hub image
image: mysql:8
# configure the instance
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test
ports:
- 3306:3306
# set health checks to wait until service has started
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
# check out revision to test
- uses: actions/checkout@v4
# install python
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
# upgrade pip
- name: Update pip
run: python -m pip install --upgrade pip
# install environment specific dependencies
- name: Install coverage
run: pip install coverage>=7.6.0 setuptools
- name: Install Django 3.2
if: matrix.django == 3.2
run: pip install "Django>=3.2,<4.0"
- name: Install Django 4.0
if: matrix.django == 4.0
run: pip install "Django>=4.0,<4.1"
- name: Install Django 4.1
if: matrix.django == 4.1
run: pip install "Django>=4.1,<4.2"
- name: Install Django 4.2
if: matrix.django == 4.2
run: pip install "Django>=4.2,<5.0"
- name: Install Django 5.0
if: matrix.django == 5.0
run: pip install "Django>=5.0,<5.1"
- name: Install Django 5.1
if: matrix.django == 5.1
run: pip install "Django>=5.1,<5.2"
- name: Install MySQL libs
if: matrix.database == 'mysql'
run: pip install mysqlclient>=2.2.4 django-mysql>=4.14.0
- name: Install postgres libs
if: matrix.database == 'postgres'
run: pip install psycopg2-binary>=2.9.9
- name: Install Django ReST framework libraries
run: pip install -U django-rest-framework rest-framework-generic-relations drf-spectacular
# install our package
- name: Install package
run: pip install -e .
# execute the tests
- name: Run tests
run: coverage run runtests/manage.py test -v3 --noinput actstream testapp testapp_nested
env:
DATABASE_ENGINE: ${{ matrix.database }}
# COVERAGE_FILE: ".coverage.${{ matrix.python_version }}"
- name: Store coverage file
uses: actions/upload-artifact@v3
with:
name: coverage
path: .coverage #.${{ matrix.python_version }}
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
flag-name: Unit Test
coveralls_finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true