-
-
Notifications
You must be signed in to change notification settings - Fork 429
203 lines (168 loc) · 5.55 KB
/
ci.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
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: CI
on: [push, pull_request]
jobs:
test:
name: >
Test Python ${{ matrix.python-version }},
Django ${{ matrix.django-version }},
Redis.py ${{ matrix.redis-version }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
django-version:
- '3.2'
- '4.1'
- '4.2'
redis-version:
- 'latest'
# Only test pre-release dependencies for the latest Python.
# And keep testing Django 3.2 with python 3.6 and 3.7
include:
# Django 3.2 and python 3.6 with latest redis
- django-version: '3.2'
redis-version: 'latest'
python-version: '3.6'
# Django 3.2 and python 3.7 with latest redis
- django-version: '3.2'
redis-version: 'latest'
python-version: '3.7'
# Django 4.1 and python 3.11 with latest redis
- django-version: '4.1'
redis-version: 'latest'
python-version: '3.11'
# Django 4.2 and python 3.11 with latest redis
- django-version: '4.2'
redis-version: 'latest'
python-version: '3.11'
# latest Django with pre-release redis
- django-version: '4.2'
redis-version: 'master'
python-version: '3.11'
# latest redis with pre-release Django
- django-version: 'main'
redis-version: 'latest'
python-version: '3.11'
# pre-release Django and redis
- django-version: 'main'
redis-version: 'master'
python-version: '3.11'
steps:
- 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: pip-test-python-${{ matrix.python-version }}-django-${{ matrix.django-version }}-redis-${{ matrix.redis-version }}-${{ hashFiles('**/setup.*') }}
restore-keys: |
pip-test-python-${{ matrix.python-version }}-django-${{ matrix.django-version }}-redis-${{ matrix.redis-version }}
pip-test-python-${{ matrix.python-version }}
pip-test-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade "tox<4" tox-gh-actions
- name: Tox tests
run: |
REDIS_PRIMARY=$(tests/start_redis.sh)
REDIS_SENTINEL=$(tests/start_redis.sh --sentinel)
CONTAINERS="$REDIS_PRIMARY $REDIS_SENTINEL"
trap "docker stop $CONTAINERS && docker rm $CONTAINERS" EXIT
tests/wait_for_redis.sh $REDIS_PRIMARY 6379
tests/wait_for_redis.sh $REDIS_SENTINEL 26379
tox
env:
DJANGO: ${{ matrix.django-version }}
REDIS: ${{ matrix.redis-version }}
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
env_vars: DJANGO,REDIS,PYTHON
flags: tests
env:
DJANGO: ${{ matrix.django-version }}
REDIS: ${{ matrix.redis-version }}
PYTHON: ${{ matrix.python-version }}
lint:
name: Lint (${{ matrix.tool }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tool:
- 'black'
- 'flake8'
- 'isort'
- 'mypy'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- 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: pip-lint-${{ hashFiles('**/setup.*') }}
restore-keys: |
pip-lint-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade "tox<4"
- name: Run ${{ matrix.tool }}
run: tox -e ${{ matrix.tool }}
- name: Upload coverage
if: ${{ matrix.tool == 'mypy' }}
uses: codecov/codecov-action@v1
with:
flags: mypy
check-changelog:
name: Check for news fragments in 'changelog.d/'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- 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: pip-check-changelog-${{ hashFiles('**/setup.*') }}
restore-keys: |
pip-check-changelog-
- name: Install dependencies
run: |
python -m pip install --upgrade towncrier
- name: Run towncrier check
run: |
if ! towncrier check; then
echo ''
echo "Please add a description of your changes to 'changelog.d/{issue or PR number}.{feature,bugfix,misc,doc,removal}'"
exit 1
fi