-
Notifications
You must be signed in to change notification settings - Fork 111
439 lines (367 loc) · 12.8 KB
/
tests.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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
name: PR tests
env:
LOWEST_SUPPORTED_PY_VERSION: '3.8'
# Trigger test workflow whenever:
# 1. A pull request is updated (e.g with new commits)
# 2. Commits are pushed directly to the dev, stage or master branch
on:
push:
branches: ["dev*", "stage*", "master*", "v*-backport*"]
pull_request:
branches: ["dev*", "stage*", "v*-backport*"]
types: [
# Default triggers
opened,
synchronize,
reopened,
# Additional triggers
labeled,
unlabeled
]
workflow_dispatch:
inputs:
test-server-rc:
type: boolean
default: false
required: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- uses: pre-commit/[email protected]
build:
runs-on: ubuntu-latest
strategy:
matrix:
py-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py-version }}
architecture: 'x64'
- run: sudo apt update
- name: Install build dependencies (apt packages)
run: sudo apt install python3-dev libssl-dev -y
- name: Install build dependencies (pip packages)
run: python3 -m pip install -r requirements.txt
- name: Build client
run: python3 -m build
env:
CFLAGS: '-Werror'
- name: Send wheel to test jobs
uses: actions/upload-artifact@v3
with:
name: wheel-${{ matrix.py-version }}
path: ./dist/*.whl
generate-coverage-report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: "3.9"
architecture: 'x64'
- name: Build client
# Use old build command to generate object .o files in build/temp*/src/main directory
# They will also contain .gcno files there
# and .gcda files will be generated there after running the tests
# The build frontend doesn't generate these .o files (may be wrong?)
run: COVERAGE=1 python3 setup.py build
- name: Install client
# Install in user directory to prevent permission errors
run: python3 setup.py install --user
- run: pip install -r requirements.txt
working-directory: test
- name: Run Aerospike server
uses: ./.github/actions/run-ee-server
with:
use-server-rc: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }}
- run: python3 -m pytest --cov=aerospike_helpers --cov-report xml:coverage.xml ./new_tests
working-directory: test
- name: Copy over source files to build dir
if: ${{ !cancelled() }}
# The build/temp*/src/main directory will contain a hierarchy of object .o files
# But the source files must be stored in the same folder hierarchy at build/temp*/src/main/src/main
run: |
cd build/temp*/src/main
mkdir -p src/main/
mkdir -p cdt_types/src/main/cdt_types
mkdir -p client/src/main/client
mkdir -p geospatial/src/main/geospatial
mkdir -p global_hosts/src/main/global_hosts
mkdir -p key_ordered_dict/src/main/key_ordered_dict
mkdir -p nullobject/src/main/nullobject
mkdir -p query/src/main/query
mkdir -p scan/src/main/scan
mkdir -p transaction/src/main/transaction
cd ../../../../
cp src/main/*.c build/temp*/src/main/src/main
cp src/main/cdt_types/*.c build/temp*/src/main/cdt_types/src/main/cdt_types/
cp src/main/client/*.c build/temp*/src/main/client/src/main/client/
cp src/main/geospatial/*.c build/temp*/src/main/geospatial/src/main/geospatial/
cp src/main/global_hosts/*.c build/temp*/src/main/global_hosts/src/main/global_hosts/
cp src/main/key_ordered_dict/*.c build/temp*/src/main/key_ordered_dict/src/main/key_ordered_dict/
cp src/main/nullobject/*.c build/temp*/src/main/nullobject/src/main/nullobject/
cp src/main/query/*.c build/temp*/src/main/query/src/main/query/
cp src/main/scan/*.c build/temp*/src/main/scan/src/main/scan/
cp src/main/transaction/*.c build/temp*/src/main/transaction/src/main/transaction/
- name: Generate coverage report for all object files
if: ${{ !cancelled() }}
run: |
cd build/temp*/src/main
find . -type f -name "*.o" -execdir gcov {} \;
- name: Move aerospike_helpers coverage report to this directory
if: ${{ !cancelled() }}
run: mv test/coverage.xml build/temp*/src/main
- name: Upload coverage report folder to Github
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: build/temp*/src/main/
coverage-upload:
needs: generate-coverage-report
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: coverage-report
path: ./coverage-report
- uses: codecov/codecov-action@v3
with:
directory: coverage-report
verbose: true # optional (default = false)
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
stubtest:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: ${{ env.LOWEST_SUPPORTED_PY_VERSION }}
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: wheel-${{ env.LOWEST_SUPPORTED_PY_VERSION }}
- name: Install client
run: pip install *.whl
- run: pip install mypy
- run: stubtest aerospike --allowlist stubtest-allowlist
# Run this when testing new server features on server release candidate
# to make sure the tests don't regress on the last server release.
test-ce-latest-release:
runs-on: ubuntu-latest
if: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
needs: build
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: ${{ env.LOWEST_SUPPORTED_PY_VERSION }}
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: wheel-${{ env.LOWEST_SUPPORTED_PY_VERSION }}
- name: Install client
run: pip install *.whl
- name: Install test dependencies
run: pip install -r test/requirements.txt
- name: Run Aerospike server
run: docker run -d --name aerospike -p 3000-3002:3000-3002 -e DEFAULT_TTL=2592000 aerospike/aerospike-server
- name: Create config.conf
run: cp config.conf.template config.conf
working-directory: test
- uses: ./.github/actions/wait-for-as-server-to-start
with:
container-name: aerospike
- name: Run tests
run: python -m pytest ./new_tests
working-directory: test
test-ce:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
py-version: [
"3.8",
"3.9",
"3.10",
"3.11",
"3.12"
]
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py-version }}
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: wheel-${{ matrix.py-version }}
- name: Install client
run: pip install *.whl
- name: Install test dependencies
run: pip install -r test/requirements.txt
- if: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
password: ${{ secrets.DOCKER_HUB_BOT_PW }}
- name: Run Aerospike server release candidate with latest tag
if: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
run: docker run -d --name aerospike -p 3000-3002:3000-3002 -e DEFAULT_TTL=2592000 aerospike/aerospike-server-rc:latest
- name: Run Aerospike server
if: ${{ !contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
run: docker run -d --name aerospike -p 3000-3002:3000-3002 -e DEFAULT_TTL=2592000 aerospike/aerospike-server
- name: Create config.conf
run: cp config.conf.template config.conf
working-directory: test
- uses: ./.github/actions/wait-for-as-server-to-start
with:
container-name: aerospike
- name: Run tests
run: python -m pytest ./new_tests -vv
working-directory: test
test-lowest-supported-server:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: ${{ env.LOWEST_SUPPORTED_PY_VERSION }}
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: wheel-${{ env.LOWEST_SUPPORTED_PY_VERSION }}
- name: Install client
run: pip install *.whl
- name: Install test dependencies
run: pip install -r test/requirements.txt
- name: Run lowest supported server
run: docker run -d --name aerospike -p 3000-3002:3000-3002 -e DEFAULT_TTL=2592000 aerospike/aerospike-server:${{ vars.LOWEST_SUPPORTED_SERVER_VERSION }}
- name: Create config.conf
run: cp config.conf.template config.conf
working-directory: test
- uses: ./.github/actions/wait-for-as-server-to-start
with:
container-name: aerospike
- name: Run tests
run: python -m pytest ./new_tests
working-directory: test
test-ee:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: ${{ env.LOWEST_SUPPORTED_PY_VERSION }}
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: wheel-${{ env.LOWEST_SUPPORTED_PY_VERSION }}
- name: Install client
run: pip install *.whl
- name: Install test dependencies
run: pip install -r test/requirements.txt
- uses: ./.github/actions/run-ee-server
with:
use-server-rc: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }}
- name: Run tests
run: python -m pytest ./new_tests/test_{mrt_functionality,admin_*}.py
working-directory: test
- name: Show logs if failed
if: ${{ failure() }}
run: |
docker container logs aerospike
cat ./configs/aerospike.conf
spellcheck-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies for checking spelling in docs
# TODO: find way to split up dependencies
run: python -m pip install -r doc/requirements.txt
- name: Check spelling
run: sphinx-build -b spelling . spelling -W --keep-going
working-directory: doc
check-links-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Install documentation dependencies
run: python -m pip install -r doc/requirements.txt
- name: Check spelling
run: sphinx-build -b linkcheck . links
working-directory: doc
test-metrics:
needs: build
strategy:
matrix:
suffix:
- node_close_listener
- cluster_name
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.LOWEST_SUPPORTED_PY_VERSION }}
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: wheel-${{ env.LOWEST_SUPPORTED_PY_VERSION }}
- run: python3 -m pip install *.whl
- run: python3 -m pip install -r requirements.txt
working-directory: test/metrics
- run: python3 test_${{ matrix.suffix }}.py
working-directory: test/metrics