-
Notifications
You must be signed in to change notification settings - Fork 46
358 lines (301 loc) · 11.3 KB
/
testing.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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
name: testing
on:
push:
pull_request:
pull_request_target:
types: [labeled]
jobs:
run_tests_ce_linux:
# We want to run on external PRs, but not on our own internal
# PRs as they'll be run by the push to the branch.
#
# The main trick is described here:
# https://github.com/Dart-Code/Dart-Code/pull/2375
if: (github.event_name == 'push') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository)
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
tarantool:
- '1.10'
- '2.8'
- '2.10'
python:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
msgpack-deps:
# latest msgpack will be installed as a part of requirements.txt
- ''
# Adding too many elements to three-dimentional matrix results in
# too many test cases. It causes GitHub webpages to fail with
# "This page is taking too long to load." error. Thus we use
# pairwise testing.
include:
- tarantool: '2.8'
python: '3.10'
msgpack-deps: 'msgpack-python==0.4.0'
- tarantool: '2.8'
python: '3.10'
msgpack-deps: 'msgpack==0.5.0'
- tarantool: '2.8'
python: '3.10'
msgpack-deps: 'msgpack==0.6.2'
- tarantool: '2.8'
python: '3.10'
msgpack-deps: 'msgpack==1.0.4'
steps:
- name: Clone the connector
uses: actions/checkout@v2
- name: Install tarantool ${{ matrix.tarantool }}
uses: tarantool/setup-tarantool@v1
with:
tarantool-version: ${{ matrix.tarantool }}
- name: Setup Python for tests
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install specific version of msgpack package
# We want to enforce using modern msgpack since it has
# various vulnerability fixes. But the code is compatible
# with older msgpack versions and msgpack-python package.
# To this test compatibility we must ignore requirements.txt
# install of the newer msgpack package by overwriting it with sed.
if: matrix.msgpack-deps != ''
run: |
pip install ${{ matrix.msgpack-deps }}
sed -i -e "s/^msgpack.*$/${{ matrix.msgpack-deps }}/" requirements.txt
- name: Install package requirements
run: pip install -r requirements.txt
- name: Install test requirements
run: pip install -r requirements-test.txt
- name: Run tests
run: make test
run_tests_ee_linux:
# The same as for run_tests_ce_linux, but it does not run on pull requests
# from forks by default. Tests will run only when the pull request is
# labeled with `full-ci`. To avoid security problems, the label must be
# reset manually for every run.
#
# We need to use `pull_request_target` because it has access to base
# repository secrets unlike `pull_request`.
if: (github.event_name == 'push') ||
(github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
github.event.label.name == 'full-ci')
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
tarantool:
- '1.10.11-0-gf0b0e7ecf-r470'
- '2.8.3-21-g7d35cd2be-r470'
- '2.10.0-1-gfa775b383-r486-linux-x86_64'
python: ['3.6', '3.7', '3.8', '3.9', '3.10']
steps:
- name: Clone the connector
uses: actions/checkout@v2
# This is needed for pull_request_target because this event runs in the
# context of the base commit of the pull request. It works fine for
# `push` and `workflow_dispatch` because the default behavior is used
# if `ref` and `repository` are empty.
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Install tarantool ${{ matrix.tarantool }}
run: |
ARCHIVE_NAME=tarantool-enterprise-bundle-${{ matrix.tarantool }}.tar.gz
curl -O -L https://${{ secrets.SDK_DOWNLOAD_TOKEN }}@download.tarantool.io/enterprise/${ARCHIVE_NAME}
tar -xzf ${ARCHIVE_NAME}
rm -f ${ARCHIVE_NAME}
- name: Setup Python for tests
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install package requirements
run: pip install -r requirements.txt
- name: Install test requirements
run: pip install -r requirements-test.txt
- name: Run tests
run: |
source tarantool-enterprise/env.sh
make test
env:
TEST_TNT_SSL: ${{ matrix.tarantool == '2.10.0-1-gfa775b383-r486-linux-x86_64' }}
run_tests_with_install_linux:
# We want to run on external PRs, but not on our own internal
# PRs as they'll be run by the push to the branch.
#
# The main trick is described here:
# https://github.com/Dart-Code/Dart-Code/pull/2375
if: (github.event_name == 'push') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository)
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
tarantool:
- '2.10'
python:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
steps:
- name: Clone the connector repo
uses: actions/checkout@v2
- name: Remove connector source code
run: |
rm -rf tarantool
rm setup.py
- name: Install tarantool ${{ matrix.tarantool }}
uses: tarantool/setup-tarantool@v1
with:
tarantool-version: ${{ matrix.tarantool }}
- name: Setup Python for tests
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install the package with pip
run: pip install git+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@$GITHUB_REF_NAME
- name: Install test requirements
run: pip install -r requirements-test.txt
- name: Run tests
run: python -m unittest discover -v
run_tests_ce_windows:
# We want to run on external PRs, but not on our own internal
# PRs as they'll be run by the push to the branch.
#
# The main trick is described here:
# https://github.com/Dart-Code/Dart-Code/pull/2375
if: github.event_name == 'push' ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository)
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
# Use reduced test matrix cause Windows pipelines are long.
tarantool:
- '1.10'
- '2.8'
- '2.10.0.g0a5ce0b9c-1'
python:
- '3.6'
- '3.10'
steps:
- name: Clone the connector
uses: actions/checkout@v2
- name: Setup Python for tests
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install connector requirements
run: pip install -r requirements.txt
- name: Install test requirements
run: pip install -r requirements-test.txt
- name: Setup WSL for tarantool
uses: Vampire/setup-wsl@v1
with:
distribution: Ubuntu-20.04
- name: Install tarantool ${{ matrix.tarantool }} for WSL (2.8 and older)
if: (matrix.tarantool == '1.10') || (matrix.tarantool == '2.8')
shell: wsl-bash_Ubuntu-20.04 {0}
run: |
curl -L https://tarantool.io/installer.sh | VER=${{ matrix.tarantool }} bash -s -- --type "release"
sudo apt install -y tarantool tarantool-dev
- name: Install tarantool ${{ matrix.tarantool }} for WSL (2.10 and newer)
if: (matrix.tarantool != '1.10') && (matrix.tarantool != '2.8')
shell: wsl-bash_Ubuntu-20.04 {0}
run: |
curl -L https://tarantool.io/release/2/installer.sh | bash -s
sudo apt install -y tarantool=${{ matrix.tarantool }} tarantool-dev=${{ matrix.tarantool }}
- name: Setup test tarantool instance
shell: wsl-bash_Ubuntu-20.04 {0}
run: |
rm -f ./tarantool.pid ./tarantool.log
TNT_PID=$(tarantool ./test/suites/lib/tarantool_python_ci.lua > tarantool.log 2>&1 & echo $!)
touch tarantool.pid
echo $TNT_PID > ./tarantool.pid
- name: Run tests
env:
REMOTE_TARANTOOL_HOST: localhost
REMOTE_TARANTOOL_CONSOLE_PORT: 3302
run: make test
- name: Stop test tarantool instance
if: ${{ always() }}
shell: wsl-bash_Ubuntu-20.04 {0}
run: |
cat tarantool.log || true
kill $(cat tarantool.pid) || true
run_tests_with_install_windows:
# We want to run on external PRs, but not on our own internal
# PRs as they'll be run by the push to the branch.
#
# The main trick is described here:
# https://github.com/Dart-Code/Dart-Code/pull/2375
if: (github.event_name == 'push') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository)
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
# Use reduced test matrix cause Windows pipelines are long.
tarantool:
- '2.10.0.g0a5ce0b9c-1'
python:
- '3.6'
- '3.10'
steps:
- name: Clone the connector repo
uses: actions/checkout@v2
- name: Remove connector source code (main folder)
uses: JesseTG/[email protected]
with:
path: tarantool
- name: Remove connector source code (setup.py)
uses: JesseTG/[email protected]
with:
path: setup.py
- name: Setup Python for tests
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install the package with pip
run: pip install git+$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY@$env:GITHUB_REF_NAME
- name: Install test requirements
run: pip install -r requirements-test.txt
- name: Setup WSL for tarantool
uses: Vampire/setup-wsl@v1
with:
distribution: Ubuntu-20.04
- name: Install tarantool ${{ matrix.tarantool }} for WSL
shell: wsl-bash_Ubuntu-20.04 {0}
run: |
curl -L https://tarantool.io/release/2/installer.sh | bash -s
sudo apt install -y tarantool=${{ matrix.tarantool }} tarantool-dev=${{ matrix.tarantool }}
- name: Setup test tarantool instance
shell: wsl-bash_Ubuntu-20.04 {0}
run: |
rm -f ./tarantool.pid ./tarantool.log
TNT_PID=$(tarantool ./test/suites/lib/tarantool_python_ci.lua > tarantool.log 2>&1 & echo $!)
touch tarantool.pid
echo $TNT_PID > ./tarantool.pid
- name: Run tests
env:
REMOTE_TARANTOOL_HOST: localhost
REMOTE_TARANTOOL_CONSOLE_PORT: 3302
run: python -m unittest discover -v
- name: Stop test tarantool instance
if: ${{ always() }}
shell: wsl-bash_Ubuntu-20.04 {0}
run: |
cat tarantool.log || true
kill $(cat tarantool.pid) || true