-
Notifications
You must be signed in to change notification settings - Fork 7
205 lines (192 loc) · 5.31 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
204
205
name: aioredis-cluster CI/CD
on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
with_aioredis:
- 'yes'
- 'no'
steps:
- uses: actions/checkout@v3
- name: 'Set up Python ${{ matrix.python-version }} (aioredis: ${{ matrix.with_aioredis }})'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -U pip setuptools
if [ "${{ matrix.with_aioredis }}" == "yes" ]; then
python -m pip install -Ue '.[devel,aioredis]';
else
python -m pip install -Ue '.[devel]'
fi
- name: Lint with flake8
run: |
make flake
- name: Lint with black
run: |
make black-check
- name: Lint with mypy
run: |
make mypy
- name: Test with pytest
run: |
make tests
system_tests:
runs-on: ubuntu-latest
strategy:
matrix:
redis-version:
- '6.0.20'
- '6.2.14'
- '7.0.14'
- '7.2.3'
with_aioredis:
- 'yes'
- 'no'
services:
redis:
# image: grokzen/redis-cluster:${{ matrix.redis-version }}
image: driverx88/redis-cluster:${{ matrix.redis-version }}
ports:
- 7000-7007:7000-7007
steps:
- uses: actions/checkout@v3
- name: 'Set up Python'
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: 'Install dependencies (aioredis: ${{ matrix.with_aioredis }})'
run: |-
python -m pip install -U pip setuptools
if [ "${{ matrix.with_aioredis }}" == "yes" ]; then
python -m pip install -Ue '.[devel,aioredis]';
else
python -m pip install -Ue '.[devel]'
fi
- name: Test with pytest and redis(v${{ matrix.redis-version }})
run: |-
pytest tests/system_tests
env:
REDIS_CLUSTER_STARTUP_NODES: 'redis://localhost:7000'
REDIS_VERSION: '${{ matrix.redis-version }}'
aioredis_tests_need_run:
runs-on: ubuntu-latest
outputs:
need_run: ${{ steps.changes.outputs.src || steps.force_run.outputs.force_run }}
steps:
- uses: dorny/paths-filter@v2
id: changes
if: |
!startsWith(github.ref, 'refs/tags/v') && github.ref != 'refs/heads/master'
with:
filters: |
src:
- '.github/workflows/**'
- 'src/aioredis_cluster/_aioredis/**'
- 'src/aioredis_cluster/aioredis/**'
- 'tests/aioredis_tests/**'
- setup.cfg
- id: force_run
if: |
startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
run: |
echo ::set-output name=force_run::true
aioredis_tests:
needs:
- aioredis_tests_need_run
if: needs.aioredis_tests_need_run.outputs.need_run == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
redis-version:
- '3.2.13'
- '4.0.14'
- '5.0.9'
- '6.0.20'
- '6.2.14'
- '7.0.14'
- '7.2.3'
steps:
- uses: actions/checkout@v3
- name: 'Set up Python'
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Build redis-server v${{ matrix.redis-version }}
uses: shogo82148/actions-setup-redis@v1
with:
redis-version: '${{ matrix.redis-version }}'
auto-start: 'false'
- name: 'Install dependencies'
run: |
python -m pip install -U pip setuptools
python -m pip install -Ue '.[devel]'
- name: Run tests aioredis_cluster._aioredis
run: |
pytest tests/aioredis_tests
pre-deploy:
runs-on: ubuntu-latest
needs:
- tests
- system_tests
- aioredis_tests
# Run only on pushing a version tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Dummy
run: |
echo "Predeploy step"
build-packages:
needs:
- pre-deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Build distrib
run: |
VERSION=$(echo '${{ github.ref }}' | cut -d"/" -f3 | cut -c2-)
echo $VERSION
make dist VERSION="$VERSION"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
deploy:
name: Deploy
needs:
- build-packages
runs-on: ubuntu-latest
steps:
- name: Download dists
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
# repository_url: https://test.pypi.org/legacy/