forked from fl00r/go-tarantool-1.6
-
Notifications
You must be signed in to change notification settings - Fork 58
364 lines (318 loc) · 12.2 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
name: testing
on:
push:
pull_request:
pull_request_target:
types: [labeled]
workflow_dispatch:
jobs:
run-tests-ce:
# 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
#
# Also we want to run it always for manually triggered workflows.
if: (github.event_name == 'push') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository) ||
(github.event_name == 'workflow_dispatch')
# We could replace it with ubuntu-latest after fixing the bug:
# https://github.com/tarantool/setup-tarantool/issues/37
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
golang:
- 1.13
tarantool:
- '1.10'
- '2.8'
- '2.10'
- '2.x-latest'
coveralls: [false]
fuzzing: [false]
include:
- tarantool: '2.x-latest'
coveralls: true
golang: 1.13
- tarantool: '2.x-latest'
fuzzing: true
golang: 1.18
coveralls: false
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
- name: Setup Tarantool ${{ matrix.tarantool }}
if: matrix.tarantool != '2.x-latest'
uses: tarantool/setup-tarantool@v2
with:
tarantool-version: ${{ matrix.tarantool }}
- name: Get Tarantool 2.x latest commit
if: matrix.tarantool == '2.x-latest'
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 2.x latest
if: matrix.tarantool == '2.x-latest'
id: cache-latest
uses: actions/cache@v3
with:
path: "${GITHUB_WORKSPACE}/bin"
key: cache-latest-${{ env.LATEST_COMMIT }}
- name: Setup Tarantool 2.x latest
if: matrix.tarantool == '2.x-latest' && steps.cache-latest.outputs.cache-hit != 'true'
run: |
tt init
sudo tt install tarantool master
- name: Add Tarantool 2.x latest to PATH
if: matrix.tarantool == '2.x-latest'
run: echo "${GITHUB_WORKSPACE}/bin" >> $GITHUB_PATH
- name: Setup golang for the connector and tests
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.golang }}
- name: Install test dependencies
run: make deps
- name: Run regression tests
run: |
make test
make testrace
- name: Run fuzzing tests
if: ${{ matrix.fuzzing }}
run: make fuzzing TAGS="go_tarantool_decimal_fuzzing"
- name: Run tests, collect code coverage data and send to Coveralls
if: ${{ matrix.coveralls }}
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make coveralls
- name: Check workability of benchmark tests
run: make bench-deps bench DURATION=1x COUNT=1
run-tests-ee:
# The same as for run-tests-ce, but it does not run on pull requests from
# forks and on forks by default. Tests from forks 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.repository == 'tarantool/go-tarantool' &&
(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')) ||
github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk-version:
- 'bundle-1.10.11-0-gf0b0e7ecf-r470'
coveralls: [false]
fuzzing: [false]
ssl: [false]
include:
- sdk-version: 'bundle-2.10.0-1-gfa775b383-r486-linux-x86_64'
coveralls: false
ssl: true
- sdk-path: 'release/linux/x86_64/2.11/'
sdk-version: 'sdk-gc64-2.11.0-0-r577.linux.x86_64'
coveralls: true
ssl: true
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: Setup Tarantool ${{ matrix.sdk-version }}
run: |
ARCHIVE_NAME=tarantool-enterprise-${{ matrix.sdk-version }}.tar.gz
curl -O -L https://${{ secrets.SDK_DOWNLOAD_TOKEN }}@download.tarantool.io/enterprise/${{ matrix.sdk-path }}${ARCHIVE_NAME}
tar -xzf ${ARCHIVE_NAME}
rm -f ${ARCHIVE_NAME}
- name: Setup golang for the connector and tests
uses: actions/setup-go@v3
with:
go-version: 1.13
- name: Install test dependencies
run: |
source tarantool-enterprise/env.sh
make deps
- name: Run regression tests
run: |
source tarantool-enterprise/env.sh
make test
make testrace
env:
TEST_TNT_SSL: ${{matrix.ssl}}
- name: Run fuzzing tests
if: ${{ matrix.fuzzing }}
run: make fuzzing TAGS="go_tarantool_decimal_fuzzing"
- name: Run tests, collect code coverage data and send to Coveralls
if: ${{ matrix.coveralls }}
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEST_TNT_SSL: ${{matrix.ssl}}
run: |
source tarantool-enterprise/env.sh
make coveralls
- name: Check workability of benchmark tests
run: make bench-deps bench DURATION=1x COUNT=1
testing_mac_os:
# 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) ||
(github.event_name == 'workflow_dispatch')
strategy:
fail-fast: false
matrix:
golang:
- 1.13
runs-on:
- macos-11
- macos-12
tarantool:
- brew
- 1.10.14
env:
# Make sense only for non-brew jobs.
#
# Set as absolute paths to avoid any possible confusion
# after changing a current directory.
T_VERSION: ${{ matrix.tarantool }}
T_SRCDIR: ${{ format('{0}/tarantool-{1}', github.workspace, matrix.tarantool) }}
T_TARDIR: ${{ format('{0}/tarantool-{1}-build', github.workspace, matrix.tarantool) }}
SRCDIR: ${{ format('{0}/{1}', github.workspace, github.repository) }}
runs-on: ${{ matrix.runs-on }}
steps:
- name: Clone the connector
uses: actions/checkout@v3
with:
path: ${{ env.SRCDIR }}
- name: Restore cache of tarantool ${{ env.T_VERSION }}
uses: actions/cache@v3
id: cache
with:
path: ${{ env.T_TARDIR }}
key: ${{ matrix.runs-on }}-${{ matrix.tarantool }}
if: matrix.tarantool != 'brew'
- name: Install latest tarantool from brew
run: brew install tarantool
if: matrix.tarantool == 'brew'
- name: Install tarantool build dependencies
run: brew install autoconf automake libtool [email protected]
if: matrix.tarantool != 'brew' && steps.cache.outputs.cache-hit != 'true'
- name: Clone tarantool ${{ env.T_VERSION }}
uses: actions/checkout@v3
with:
repository: tarantool/tarantool
ref: ${{ env.T_VERSION }}
path: ${{ env.T_TARDIR }}
submodules: true
# fetch-depth is 1 by default and it is okay for
# building from a tag. However we have master in
# the version list.
fetch-depth: 0
if: matrix.tarantool != 'brew' && steps.cache.outputs.cache-hit != 'true'
- name: Build tarantool ${{ env.T_VERSION }} from sources
run: |
cd "${T_TARDIR}"
# Set RelWithDebInfo just to disable -Werror.
#
# There are tarantool releases on which AppleClang
# complains about the problem that was fixed later in
# https://github.com/tarantool/tarantool/commit/7e8688ff8885cc7813d12225e03694eb8886de29
#
# Set OpenSSL root directory for linking tarantool with OpenSSL of version 1.1
# This is related to #49. There are too much deprecations which affect the build and tests.
# Must be revisited after fixing https://github.com/tarantool/tarantool/issues/6477
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_DIST=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/[email protected] -DOPENSSL_LIBRARIES=/usr/local/opt/[email protected]/lib
# {{{ Workaround Mac OS build failure (gh-6076)
#
# https://github.com/tarantool/tarantool/issues/6076
#
# In brief: when "src/lib/small" is in include paths,
# `#include <version>` from inside Mac OS SDK headers
# attempts to include "src/lib/small/VERSION" as a
# header file that leads to a syntax error.
#
# It was fixed in the following commits:
#
# * 1.10.10-24-g7bce4abd1
# * 2.7.2-44-gbb1d32903
# * 2.8.1-56-ga6c29c5af
# * 2.9.0-84-gc5ae543f3
#
# However applying the workaround for all versions looks
# harmless.
#
# Added -f just in case: I guess we'll drop this useless
# obsoleted VERSION file from the git repository sooner
# or later.
rm -f src/lib/small/VERSION
# The same as above, but for the VERSION file generated
# by tarantool's CMake script.
rm VERSION
# }}} Workaround Mac OS build failure (gh-6076)
# Continue the build.
make -j$(sysctl -n hw.logicalcpu)
make install
if: matrix.tarantool != 'brew' && steps.cache.outputs.cache-hit != 'true'
- name: Install tarantool
run: |
cd "${T_TARDIR}"
make install
if: matrix.tarantool != 'brew' && steps.cache.outputs.cache-hit == 'true'
- name: Verify tarantool version
run: |
# Workaround https://github.com/tarantool/tarantool/issues/4983
# Workaround https://github.com/tarantool/tarantool/issues/5040
tarantool -e "require('fiber').sleep(0) assert(_TARANTOOL:startswith('${T_VERSION}'), _TARANTOOL) os.exit()"
if: matrix.tarantool != 'brew' && matrix.tarantool != 'master'
- name: Setup golang for the connector and tests
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.golang }}
# Workaround for Mac OS 12 testrace failure
# https://github.com/golang/go/issues/49138
- name: disable MallocNanoZone for macos-12
run: echo "MallocNanoZone=0" >> $GITHUB_ENV
if: matrix.runs-on == 'macos-12'
- name: Install test dependencies
run: |
brew install luarocks
cd "${SRCDIR}"
make deps
- name: Run regression tests
run: |
cd "${SRCDIR}"
make test
make testrace
- name: Run fuzzing tests
if: ${{ matrix.fuzzing }}
run: |
cd "${SRCDIR}"
make fuzzing TAGS="go_tarantool_decimal_fuzzing"
- name: Check workability of benchmark tests
run: |
cd "${SRCDIR}"
make bench-deps bench DURATION=1x COUNT=1