/
config.yml
388 lines (359 loc) · 10.1 KB
/
config.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
version: 2.1
commands:
early-returns:
steps:
- run:
name: Early return if this is a docs build
command: |
if [[ $CIRCLE_BRANCH == *docs ]]; then
echo "Identifies as documents PR, no testing required."
circleci step halt
fi
- run:
name: Early return if this branch should ignore CI
command: |
if [[ $CIRCLE_BRANCH == *noci ]]; then
echo "Identifies as actively ignoring CI, no testing required."
circleci step halt
fi
early-return-for-forked-pull-requests:
description: >-
If this build is from a fork, stop executing the current job and return success.
This is useful to avoid steps that will fail due to missing credentials.
steps:
- run:
name: Early return if this build is from a forked PR
command: |
if [[ -n "$CIRCLE_PR_NUMBER" ]]; then
echo "Nothing to do for forked PRs, so marking this step successful"
circleci step halt
fi
setup-executor:
steps:
- run:
name: Setup executor
command: |
apt-get -qq update
apt-get -q install -y git openssh-client curl ca-certificates make tar gzip
bash <(curl -fsSL https://get.docker.com)
- setup_remote_docker:
version: 20.10.2
docker_layer_caching: true
setup-automation:
steps:
- run:
name: Setup automation
command: |
git submodule update --init deps/readies
./deps/readies/bin/getpy3
checkout-all:
steps:
- checkout
- run:
name: Checkout submodules
command: git submodule update --init --recursive
persist-artifacts:
steps:
- persist_to_workspace:
root: bin/
paths:
- artifacts/snapshots/*.zip
- artifacts/snapshots/*.tgz
- artifacts/snapshots/*.tar
- artifacts/*.zip
- artifacts/*.tgz
- artifacts/*.tar
- run:
name: Cleanup test log dir
command: rm -f tests/pytest/logs/*.rdb
- store_artifacts:
path: tests/pytest/logs
build-steps:
parameters:
build_params:
type: string
default: ""
test_params:
type: string
default: ""
redis_version:
type: string
default: "6"
getredis_params:
type: string
default: ""
steps:
- checkout-all
- run:
name: Setup automation and install dependencies
command: |
./deps/readies/bin/getpy3
python3 -m pip list -v
./system-setup.py
python3 -m pip list -v
source $HOME/.cargo/env
rustc --version
cargo --version
rustup --version
- run:
name: Install Redis
command: |
bash -l -c "./deps/readies/bin/getredis -v <<parameters.redis_version>> --force <<parameters.getredis_params>>"
redis-server --version
- restore_cache:
keys:
- v3-dependencies-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Check formatting
command: bash -l -c "make lint"
- run:
name: Build debug
command: bash -l -c "make build DEBUG=1 <<parameters.build_params>>"
- run:
name: Build release
command: bash -l -c "make build pack <<parameters.build_params>>"
- save_cache:
key: v3-dependencies-{{ arch }}-{{ checksum "Cargo.lock" }}
paths:
- "~/.cargo"
- "./target"
test-steps:
steps:
- checkout-all
- run:
name: Run all tests
command: bash -l -c "make pytest"
- save_cache:
key: v2-dependencies-{{ arch }}-{{ checksum "Cargo.lock" }}
paths:
- "~/.cargo"
- "./target"
- persist-artifacts
platforms-build-steps:
parameters:
platform:
type: string
steps:
- early-returns
- setup-executor
- checkout-all
- setup-automation
- run:
name: Build for platform
command: |
cd build/platforms
make build OSNICK=<<parameters.platform>> VERSION=$CIRCLE_TAG BRANCH=$CIRCLE_BRANCH ARTIFACTS=1 TEST=1 SHOW=1
- early-return-for-forked-pull-requests
- run:
name: Build for platform (publish)
command: |
docker login -u redisfab -p $DOCKER_REDISFAB_PWD
cd build/platforms
make publish OSNICK=<<parameters.platform>> VERSION=$CIRCLE_TAG BRANCH=$CIRCLE_BRANCH OFFICIAL=0 SHOW=1 VERBOSE=1
- persist-artifacts
benchmark-steps:
parameters:
github_actor:
type: string
default: $CIRCLE_USERNAME
module_path:
type: string
default: ../../target/release/rejson.so
steps:
- run:
name: Install remote benchmark tool dependencies
command: |
VERSION=0.14.8 ./deps/readies/bin/getterraform
- run:
name: Install remote benchmark python dependencies
command: python3 -m pip install -r ./tests/benchmarks/requirements.txt
- run:
name: Run CI benchmarks on aws
timeout: 60m
no_output_timeout: 30m
command: |
cd ./tests/benchmarks
export AWS_ACCESS_KEY_ID=$PERFORMANCE_EC2_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=$PERFORMANCE_EC2_SECRET_KEY
export AWS_DEFAULT_REGION=$PERFORMANCE_EC2_REGION
export EC2_PRIVATE_PEM=$PERFORMANCE_EC2_PRIVATE_PEM
redisbench-admin run-remote \
--required-module ReJSON \
--module_path << parameters.module_path >> \
--github_actor << parameters.github_actor >> \
--github_repo $CIRCLE_PROJECT_REPONAME \
--github_org $CIRCLE_PROJECT_USERNAME \
--github_sha $CIRCLE_SHA1 \
--github_branch $CIRCLE_BRANCH \
--upload_results_s3 \
--triggering_env circleci \
--push_results_redistimeseries
jobs:
build:
docker:
- image: redisfab/rmbuilder:6.2.1-x64-buster
steps:
- build-steps
- test-steps
platforms-build:
parameters:
platform:
type: string
docker:
- image: debian:buster
steps:
- platforms-build-steps:
platform: <<parameters.platform>>
build-macos:
macos:
xcode: 11.6.0
steps:
- build-steps
- test-steps
deploy-artifacts:
parameters:
location:
type: string
default: ""
docker:
- image: redisfab/rmbuilder:6.2.1-x64-buster
steps:
- early-returns
- early-return-for-forked-pull-requests
- attach_workspace:
at: workspace
- run:
name: Deploy to S3
command: |
cd "workspace/artifacts/<<parameters.location>>"
du -ah --apparent-size *
if [[ -z <<parameters.location>> ]]; then
path="/"
else
path="<<parameters.location>>/"
fi
for f in `ls *.zip *.tgz`; do
aws s3 cp $f s3://redismodules/$PACKAGE_NAME/$path --acl public-read
done
release-automation:
docker:
- image: redisfab/rmbuilder:6.2.1-x64-buster
steps:
- checkout
- setup-automation
- run:
name: Run QA Automation
command: MODULE_VERSION=$CIRCLE_TAG VERBOSE=1 TEST=release ./tests/qa/run
nightly-automation:
docker:
- image: redisfab/rmbuilder:6.2.1-x64-buster
steps:
- checkout
- setup-automation
- run:
name: Run QA Automation
command: MODULE_VERSION=$CIRCLE_BRANCH VERBOSE=1 TEST=nightly QUICK=1 ./tests/qa/run
performance-automation:
docker:
- image: redisfab/rmbuilder:6.2.1-x64-bionic
steps:
- build-steps
- benchmark-steps
on-any-branch: &on-any-branch
filters:
branches:
only: /.*/
tags:
only: /.*/
never: &never
filters:
branches:
ignore: /.*/
tags:
ignore: /.*/
on-master: &on-master
filters:
branches:
only: master
tags:
ignore: /.*/
on-integ-branch: &on-integ-branch
filters:
branches:
only:
- master
- /^\d+\.\d+.*$/
- /^feature-.*$/
tags:
ignore: /.*/
not-on-integ-branch: ¬-on-integ-branch
filters:
branches:
ignore:
- master
- /^\d+\.\d+.*$/
- /^feature-.*$/
tags:
ignore: /.*/
on-version-tags: &on-version-tags
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9].*/
on-integ-and-version-tags: &on-integ-and-version-tags
filters:
branches:
only:
- master
- /^\d+\.\d+.*$/
- /^feature-.*$/
tags:
only: /^v[0-9].*/
workflows:
version: 2
default-flow:
jobs:
- build:
<<: *not-on-integ-branch
- platforms-build:
context: common
<<: *on-integ-and-version-tags
matrix:
parameters:
platform: [focal, bionic, xenial, centos7]
- build-macos:
<<: *on-integ-and-version-tags
- deploy-artifacts:
name: deploy_snapshot
location: snapshots
context: common
<<: *on-integ-branch
requires:
- platforms-build
- deploy-artifacts:
name: deploy_release
context: common
<<: *on-version-tags
requires:
- platforms-build
- release-automation:
<<: *on-version-tags
requires:
- deploy_release
- performance-automation:
<<: *on-integ-and-version-tags
context: common
nightly:
triggers:
- schedule:
cron: "07 20 * * *"
filters:
branches:
only:
- master
- /^feature-.*$/
jobs:
- nightly-automation
- performance-automation:
context: common