-
Notifications
You must be signed in to change notification settings - Fork 46
400 lines (335 loc) · 12.9 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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
name: testing
on:
push:
pull_request:
pull_request_target:
types: [labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
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'
- '2.11'
- 'master'
python:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
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.11'
python: '3.11'
msgpack-deps: 'msgpack==0.5.0'
- tarantool: '2.11'
python: '3.11'
msgpack-deps: 'msgpack==0.6.2'
- tarantool: '2.11'
python: '3.11'
msgpack-deps: 'msgpack==1.0.4'
steps:
- name: Clone the connector
uses: actions/checkout@v3
- name: Setup tt
run: |
curl -L https://tarantool.io/release/2/installer.sh | sudo bash
sudo apt install -y tt
tt version
tt init
- name: Install tarantool ${{ matrix.tarantool }}
if: matrix.tarantool != 'master'
uses: tarantool/setup-tarantool@v2
with:
tarantool-version: ${{ matrix.tarantool }}
- name: Get Tarantool master latest commit
if: matrix.tarantool == 'master'
run: |
commit_hash=$(git ls-remote https://github.com/tarantool/tarantool.git --branch master | head -c 8)
echo "LATEST_COMMIT=${commit_hash}" >> $GITHUB_ENV
shell: bash
- name: Cache Tarantool master
if: matrix.tarantool == 'master'
id: cache-latest
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/bin
${{ github.workspace }}/include
key: cache-latest-${{ env.LATEST_COMMIT }}
- name: Setup Tarantool master
if: matrix.tarantool == 'master' && steps.cache-latest.outputs.cache-hit != 'true'
run: |
tt install tarantool master
- name: Add Tarantool master to PATH
if: matrix.tarantool == 'master'
run: echo "${GITHUB_WORKSPACE}/bin" >> $GITHUB_PATH
- name: Setup Python for tests
uses: actions/setup-python@v4
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: |
pip3 install ${{ matrix.msgpack-deps }}
sed -i -e "s/^msgpack.*$/${{ matrix.msgpack-deps }}/" requirements.txt
- name: Install package requirements
run: pip3 install -r requirements.txt
- name: Install test requirements
run: pip3 install -r requirements-test.txt
- name: Install the crud module for testing purposes
run: |
tt rocks install crud
- 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:
- bundle: 'sdk-1.10.15-0-r563'
path: 'release/linux/x86_64/1.10/'
- bundle: 'sdk-2.8.4-0-r563'
path: 'release/linux/x86_64/2.8/'
- bundle: 'sdk-gc64-2.10.7-0-r563.linux.x86_64'
path: 'release/linux/x86_64/2.10/'
- bundle: 'sdk-gc64-2.11.0-0-r563.linux.x86_64'
path: 'release/linux/x86_64/2.11/'
python: ['3.7', '3.11']
steps:
- name: Clone the connector
# `ref` as merge request is needed for pull_request_target because this
# target runs in the context of the base commit of the pull request.
uses: actions/checkout@v3
if: github.event_name == 'pull_request_target'
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Clone the connector
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v3
- name: Install Tarantool EE SDK
run: |
ARCHIVE_NAME=tarantool-enterprise-${{ matrix.tarantool.bundle }}.tar.gz
curl -O -L https://${{ secrets.SDK_DOWNLOAD_TOKEN }}@download.tarantool.io/enterprise/${{ matrix.tarantool.path }}${ARCHIVE_NAME}
tar -xzf ${ARCHIVE_NAME}
rm -f ${ARCHIVE_NAME}
- name: Setup Python for tests
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install package requirements
run: pip3 install -r requirements.txt
- name: Install test requirements
run: pip3 install -r requirements-test.txt
- name: Install the crud module for testing purposes
# This is a workaround with TARANTOOL_DIR and should be reworked later.
# See more here: https://github.com/tarantool/tt/issues/282
run: |
source tarantool-enterprise/env.sh
curl -L https://tarantool.io/release/2/installer.sh | bash
sudo apt install -y tt
tt rocks install crud TARANTOOL_DIR=$PWD/tarantool-enterprise
- name: Run tests
run: |
source tarantool-enterprise/env.sh
make test
env:
TEST_TNT_SSL: ${{ matrix.tarantool.bundle == 'sdk-gc64-2.10.7-0-r563.linux.x86_64' ||
matrix.tarantool.bundle == 'sdk-gc64-2.11.0-0-r563.linux.x86_64'}}
run_tests_pip_branch_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.11'
python:
- '3.7'
- '3.11'
steps:
- name: Clone the connector repo
uses: actions/checkout@v3
- name: Install tarantool ${{ matrix.tarantool }}
uses: tarantool/setup-tarantool@v2
with:
tarantool-version: ${{ matrix.tarantool }}
- name: Setup Python for tests
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Remove connector source code
run: python3 .github/scripts/remove_source_code.py
- name: Install the package with pip
run: pip3 install git+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@$GITHUB_REF
- name: Install test requirements
run: pip3 install -r requirements-test.txt
- name: Install the crud module for testing purposes
run: |
curl -L https://tarantool.io/release/2/installer.sh | bash
sudo apt install -y tt
tt rocks install crud
- name: Run tests
run: make test-pure-install
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:
- '2.11.0.g247a9a418-1'
python:
- '3.7'
- '3.11'
steps:
- name: Clone the connector
uses: actions/checkout@v3
- name: Setup Python for tests
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install connector requirements
run: pip3 install -r requirements.txt
- name: Install test requirements
run: pip3 install -r requirements-test.txt
- name: Setup WSL for tarantool
uses: Vampire/setup-wsl@v2
with:
distribution: Ubuntu-22.04
- name: Install tarantool ${{ matrix.tarantool }} for WSL (2.10 and newer)
shell: wsl-bash_Ubuntu-22.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-22.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-22.04 {0}
run: |
cat tarantool.log || true
kill $(cat tarantool.pid) || true
run_tests_pip_branch_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.11.0.g247a9a418-1'
python:
- '3.7'
- '3.11'
steps:
- name: Clone the connector repo
uses: actions/checkout@v3
- name: Setup Python for tests
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Remove connector source code
run: python3 .github/scripts/remove_source_code.py
- name: Install the package with pip
run: pip3 install git+$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY@$env:GITHUB_REF
- name: Install test requirements
run: pip3 install -r requirements-test.txt
- name: Setup WSL for tarantool
uses: Vampire/setup-wsl@v2
with:
distribution: Ubuntu-22.04
- name: Install tarantool ${{ matrix.tarantool }} for WSL
shell: wsl-bash_Ubuntu-22.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-22.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-pure-install
- name: Stop test tarantool instance
if: ${{ always() }}
shell: wsl-bash_Ubuntu-22.04 {0}
run: |
cat tarantool.log || true
kill $(cat tarantool.pid) || true