forked from espressif/esp-idf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
537 lines (476 loc) · 13.9 KB
/
.gitlab-ci.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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
stages:
- build
- unit_test
- test
- test_report
- deploy
before_script:
# add gitlab ssh key
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
# if testing master branch, use github wifi and bt libs.
# if testing other branches, use gitlab wifi and bt libs (as maybe changes aren't merged to master yet)
- test "${CI_BUILD_REF_NAME}" = "master" || sed -i "s%https://github.com/espressif/esp32-wifi-lib%${GITLAB_SSH_SERVER}/idf/esp32-wifi-lib%" .gitmodules
- test "${CI_BUILD_REF_NAME}" = "master" || sed -i "s%https://github.com/espressif/esp32-bt-lib%${GITLAB_SSH_SERVER}/idf/esp32-bt-lib%" .gitmodules
# fetch all submodules
- git submodule update --init --recursive
build_template_app:
stage: build
image: espressif/esp32-ci-env
tags:
- build
variables:
SDK_PATH: "$CI_PROJECT_DIR"
IDF_PATH: "$CI_PROJECT_DIR"
GIT_STRATEGY: clone
script:
- git clone https://github.com/espressif/esp-idf-template.git
- cd esp-idf-template
# Try to use the same branch name for esp-idf-template that we're
# using on esp-idf. If it doesn't exist then just stick to the default
# branch
- git checkout ${CI_BUILD_REF_NAME} || echo "Using esp-idf-template default branch..."
- make defconfig
# Test debug build (default)
- make all V=1
# Now test release build
- make clean
- sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
- make defconfig
- make all V=1
# Check if there are any stray printf/ets_printf references in WiFi libs
- cd ../components/esp32/lib
- test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
- test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0
.build_gitlab: &build_template
stage: build
tags:
- build
image: espressif/esp32-ci-env
variables:
SDK_PATH: "$CI_PROJECT_DIR"
IDF_PATH: "$CI_PROJECT_DIR"
GIT_STRATEGY: clone
build_ssc:
<<: *build_template
artifacts:
paths:
- ./SSC/ssc_bin
expire_in: 6 mos
script:
- git clone $GITLAB_SSH_SERVER/yinling/SSC.git
- cd SSC
- git checkout ${CI_BUILD_REF_NAME} || echo "Using SSC default branch..."
- make defconfig
- chmod +x gen_misc_ng.sh
- ./gen_misc_ng.sh
build_esp_idf_tests:
<<: *build_template
artifacts:
paths:
- ./tools/unit-test-app/build/*.bin
- ./tools/unit-test-app/build/*.elf
- ./tools/unit-test-app/build/*.map
- ./tools/unit-test-app/build/bootloader/*.bin
expire_in: 6 mos
script:
- cd tools/unit-test-app
- git checkout ${CI_BUILD_REF_NAME} || echo "Using default branch..."
- make defconfig
- make TESTS_ALL=1
build_examples:
<<: *build_template
artifacts:
paths:
- build_examples/*/*/build/*.bin
- build_examples/*/*/build/*.elf
- build_examples/*/*/build/*.map
- build_examples/*/*/build/bootloader/*.bin
expire_in: 6 mos
script:
# it's not possible to build 100% out-of-tree and have the "artifacts"
# mechanism work, but this is the next best thing
- mkdir build_examples
- cd build_examples
- ${IDF_PATH}/make/build_examples.sh
build_docs:
stage: build
image: espressif/esp32-ci-env
tags:
- build_docs
script:
- cd docs
- doxygen
# If not building master branch, and there are Doxygen warnings, print them and bail out
- test "${CI_BUILD_REF_NAME}" = "master" || test $(cat doxygen-warning-log.txt | wc -l) -eq 0 || ( echo "Doxygen pass had some warnings:" && cat doxygen-warning-log.txt && false )
- make html
artifacts:
paths:
- docs/_build/html
expire_in: 1 mos
test_nvs_on_host:
stage: test
image: espressif/esp32-ci-env
tags:
- nvs_host_test
script:
- cd components/nvs_flash/test_nvs_host
- make test
test_build_system:
stage: test
image: espressif/esp32-ci-env
tags:
- build_test
variables:
IDF_PATH: "$CI_PROJECT_DIR"
script:
- ./make/test_build_system.sh
test_report:
stage: test_report
only:
- master
- triggers
tags:
- test_report
variables:
LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test"
REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report"
artifacts:
when: always
paths:
- $REPORT_PATH
- $LOG_PATH
expire_in: 12 mos
script:
# clone test bench
- git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
- cd auto_test_script
# generate report
- python CITestReport.py -l $LOG_PATH -t $TEST_CASE_FILE_PATH -p $REPORT_PATH
push_master_to_github:
before_script:
- echo "Not setting up GitLab key, not fetching submodules"
stage: deploy
only:
- master
tags:
- deploy
when: on_success
image: espressif/esp32-ci-env
variables:
GIT_STRATEGY: clone
script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- git remote add github [email protected]:espressif/esp-idf.git
- git push --follow-tags github HEAD:master
deploy_docs:
before_script:
- echo "Not setting up GitLab key, not fetching submodules"
stage: deploy
only:
- master
- triggers
tags:
- deploy
image: espressif/esp32-ci-env
script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
- export GIT_VER=$(git describe --always)
- cd docs/_build/
- mv html $GIT_VER
- tar czvf $GIT_VER.tar.gz $GIT_VER
- scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH
- ssh $DOCS_SERVER -x "cd $DOCS_PATH && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
# AUTO GENERATED PART START, DO NOT MODIFY CONTENT BELOW
# template for test jobs
.test_template: &test_template
stage: test
when: on_success
only:
- master
- triggers
allow_failure: true
variables:
# LOCAL_ENV_CONFIG_PATH: define in template and jobs can overwrite if required
LOCAL_ENV_CONFIG_PATH: /home/gitlab-runner/LocalConfig/ESP32_IDF
BIN_PATH: "$CI_PROJECT_DIR/SSC/ssc_bin/SSC"
APP_NAME: "ssc"
LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
# append test level folder to TEST_CASE_FILE_PATH in before_script of test job
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
# jobs MUST set CONFIG_FILE in before_script, and overwrite the variables above if necessary
artifacts:
when: always
paths:
- $LOG_PATH
expire_in: 6 mos
script:
# remove artifacts from last stage (UT logs)
- rm -rf $LOG_PATH
# add gitlab ssh key
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
# clone test bench
- git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
- cd auto_test_script
# run test
- python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH
# template for overnight test jobs
.test_template_night: &test_template_night
<<: *test_template
only:
# can only be triggered
- triggers
script:
# remove artifacts from last stage (UT logs)
- rm -rf $LOG_PATH
# must be night build triggers, otherwise exit without test
- test $NIGHT_BUILD = "Yes" || exit 0
# add gitlab ssh key
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
# clone test bench
- git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
- cd auto_test_script
# run test
- python CIRunner.py -l $LOG_PATH -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH bin_path $APP_NAME $BIN_PATH
# template for unit test jobs
.unit_test_template: &unit_test_template
<<: *test_template
allow_failure: false
stage: unit_test
variables:
# jobs MUST set CONFIG_FILE in before_script, and overwrite the variables above if necessary
LOCAL_ENV_CONFIG_PATH: /home/gitlab-runner/LocalConfig/ESP32_IDF
BIN_PATH: "$CI_PROJECT_DIR/tools/unit-test-app/build/"
LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
APP_NAME: "ut"
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/unit_test"
UT_Function_SYS_01:
<<: *unit_test_template
tags:
- ESP32_IDF
- UT_T1_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/UT_Function_SYS_01.yml
IT_Function_SYS_01:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_SYS_01.yml
IT_Function_WIFI_01:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
- SSC_T2_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_01.yml
IT_Function_WIFI_02:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
- SSC_T2_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_02.yml
IT_Function_TCPIP_01:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
- SSC_T2_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_01.yml
IT_Function_TCPIP_02:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_02.yml
IT_Function_TCPIP_03:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
- SSC_T2_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_03.yml
IT_Function_TCPIP_04:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
- SSC_T2_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_04.yml
IT_Function_TCPIP_05:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_05.yml
IT_Stress_WIFI_01:
<<: *test_template_night
tags:
- ESP32_IDF
- SSC_T5_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_WIFI_01.yml
IT_Stress_TCPIP_01:
<<: *test_template_night
tags:
- ESP32_IDF
- SSC_T1_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_01.yml
IT_Stress_TCPIP_02:
<<: *test_template_night
tags:
- ESP32_IDF
- SSC_T2_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_02.yml
IT_Stress_TCPIP_03:
<<: *test_template_night
tags:
- ESP32_IDF
- SSC_T1_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_03.yml
IT_Stress_TCPIP_04:
<<: *test_template_night
tags:
- ESP32_IDF
- SSC_T2_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_04.yml
IT_Stable_TCPIP_01:
<<: *test_template_night
tags:
- ESP32_IDF
- SSC_T5_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stable_TCPIP_01.yml
IT_Stable_TCPIP_02:
<<: *test_template_night
tags:
- ESP32_IDF
- SSC_T1_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stable_TCPIP_02.yml
IT_Stable_TCPIP_03:
<<: *test_template_night
tags:
- ESP32_IDF
- SSC_T5_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stable_TCPIP_03.yml
IT_Function_TCPIP_06:
<<: *test_template_night
tags:
- ESP32_IDF
- SSC_T1_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_06.yml
IT_Function_WIFI_03:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_APC
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_03.yml
IT_Function_WIFI_04:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T3_PhyMode
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_04.yml
IT_Function_WIFI_05:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_WEP
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_05.yml
IT_Function_WIFI_06:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T2_PhyMode
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_06.yml
IT_Function_TCPIP_07:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
- SSC_T1_2
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_07.yml
IT_Function_TCPIP_08:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
- SSC_T2_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_08.yml
IT_Function_TCPIP_09:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
- SSC_T1_2
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_09.yml
IT_Function_TCPIP_10:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
- SSC_T1_2
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_10.yml
IT_Function_TCPIP_11:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_11.yml
IT_Function_TCPIP_12:
<<: *test_template
tags:
- ESP32_IDF
- SSC_T1_1
before_script:
- CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_12.yml