]> granicus.if.org Git - esp-idf/blob - .gitlab-ci.yml
Merge branch 'feature/btdm_common_api' into 'master'
[esp-idf] / .gitlab-ci.yml
1 stages:
2   - build
3   - unit_test
4   - test
5   - test_report
6   - deploy
7
8 before_script:
9   # add gitlab ssh key
10   - mkdir -p ~/.ssh
11   - chmod 700 ~/.ssh
12   - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
13   - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
14   - chmod 600 ~/.ssh/id_rsa
15   - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
16
17   # if testing master branch, use github wifi and bt libs.
18   # if testing other branches, use gitlab wifi and bt libs (as maybe changes aren't merged to master yet)
19   - test "${CI_BUILD_REF_NAME}" = "master" || sed -i "s%https://github.com/espressif/esp32-wifi-lib%${GITLAB_SSH_SERVER}/idf/esp32-wifi-lib%" .gitmodules
20   - test "${CI_BUILD_REF_NAME}" = "master" || sed -i "s%https://github.com/espressif/esp32-bt-lib%${GITLAB_SSH_SERVER}/idf/esp32-bt-lib%" .gitmodules
21   # fetch all submodules
22   - git submodule update --init --recursive
23
24 build_template_app:
25   stage: build
26   image: espressif/esp32-ci-env
27   tags:
28     - build
29
30   variables:
31     SDK_PATH: "$CI_PROJECT_DIR"
32     IDF_PATH: "$CI_PROJECT_DIR"
33     GIT_STRATEGY: clone
34
35   script:
36     - git clone https://github.com/espressif/esp-idf-template.git
37     - cd esp-idf-template
38     # Try to use the same branch name for esp-idf-template that we're
39     # using on esp-idf. If it doesn't exist then just stick to the default
40     # branch
41     - git checkout ${CI_BUILD_REF_NAME} || echo "Using esp-idf-template default branch..."
42     - make defconfig
43     # Test debug build (default)
44     - make all V=1
45     # Now test release build
46     - make clean
47     - sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
48     - make defconfig
49     - make all V=1
50     # Check if there are any stray printf/ets_printf references in WiFi libs
51     - cd ../components/esp32/lib
52     - test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
53     - test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0
54
55
56 .build_gitlab: &build_template
57   stage: build
58   tags:
59     - build
60   image: espressif/esp32-ci-env
61
62   variables:
63     SDK_PATH: "$CI_PROJECT_DIR"
64     IDF_PATH: "$CI_PROJECT_DIR"
65     GIT_STRATEGY: clone
66
67 build_ssc:
68   <<: *build_template
69   artifacts:
70     paths:
71       - ./SSC/ssc_bin
72     expire_in: 6 mos
73
74   script:
75     - git clone $GITLAB_SSH_SERVER/yinling/SSC.git
76     - cd SSC
77     - git checkout ${CI_BUILD_REF_NAME} || echo "Using SSC default branch..."
78     - make defconfig
79     - chmod +x gen_misc_ng.sh
80     - ./gen_misc_ng.sh
81
82 build_esp_idf_tests:
83   <<: *build_template
84   artifacts:
85     paths:
86       - ./tools/unit-test-app/build/*.bin
87       - ./tools/unit-test-app/build/*.elf
88       - ./tools/unit-test-app/build/*.map
89       - ./tools/unit-test-app/build/bootloader/*.bin
90     expire_in: 6 mos
91
92   script:
93     - cd tools/unit-test-app
94     - git checkout ${CI_BUILD_REF_NAME} || echo "Using default branch..."
95     - make defconfig
96     - make TESTS_ALL=1
97
98 build_examples:
99   <<: *build_template
100   artifacts:
101     paths:
102       - build_examples/*/*/build/*.bin
103       - build_examples/*/*/build/*.elf
104       - build_examples/*/*/build/*.map
105       - build_examples/*/*/build/bootloader/*.bin
106     expire_in: 6 mos
107
108   script:
109     # it's not possible to build 100% out-of-tree and have the "artifacts"
110     # mechanism work, but this is the next best thing
111     - mkdir build_examples
112     - cd build_examples
113     - ${IDF_PATH}/make/build_examples.sh
114
115 build_docs:
116   stage: build
117   image: espressif/esp32-ci-env
118   tags:
119     - build_docs
120   script:
121     - cd docs
122     - doxygen
123     # If not building master branch, and there are Doxygen warnings, print them and bail out
124     - 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 )
125     - make html
126   artifacts:
127     paths:
128       - docs/_build/html
129     expire_in: 1 mos
130
131
132 test_nvs_on_host:
133   stage: test
134   image: espressif/esp32-ci-env
135   tags:
136     - nvs_host_test
137   script:
138     - cd components/nvs_flash/test_nvs_host
139     - make test
140
141 test_build_system:
142   stage: test
143   image: espressif/esp32-ci-env
144   tags:
145     - build_test
146   variables:
147     IDF_PATH: "$CI_PROJECT_DIR"
148   script:
149     - ./make/test_build_system.sh
150
151 test_report:
152   stage: test_report
153   image: espressif/esp32-ci-env
154   only:
155     - master
156     - triggers
157   tags:
158     - report
159   variables:
160     LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
161     TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test"
162     REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report"
163   artifacts:
164     when: always
165     paths:
166       - $REPORT_PATH
167       - $LOG_PATH
168     expire_in: 12 mos
169   script:
170     # calc log path
171     - VER_NUM=`git rev-list HEAD | wc -l | awk '{print $1}'`
172     - SHA_ID=`echo $CI_BUILD_REF | cut -c 1-7`
173     - REVISION="${VER_NUM}_${SHA_ID}"
174     # replace / to _ in branch name
175     - ESCAPED_BRANCH_NAME=`echo $CI_BUILD_REF_NAME | sed 's/\//___/g'`
176     # result path and artifacts path
177     - RESULT_PATH="$CI_PROJECT_NAME/$ESCAPED_BRANCH_NAME/$REVISION"
178     - ARTIFACTS_PATH="$GITLAB_HTTP_SERVER/idf/esp-idf/builds/$CI_BUILD_ID/artifacts/browse/$CI_BUILD_REF"
179     # clone test bench
180     - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
181     - cd auto_test_script
182     # generate report
183     - TEST_RESULT=Pass
184     - python CITestReport.py -l $LOG_PATH -t $TEST_CASE_FILE_PATH -p $REPORT_PATH -r $RESULT_PATH -a $ARTIFACTS_PATH || TEST_RESULT=Fail
185     # commit to CI-test-result project
186     - git clone $GITLAB_SSH_SERVER/qa/CI-test-result.git
187     - rm -rf CI-test-result/RawData/$RESULT_PATH
188     - cp -R $CI_PROJECT_NAME CI-test-result/RawData
189     - cd CI-test-result
190     # config git user
191     - git config --global user.email "ci-test-result@espressif.com"
192     - git config --global user.name "ci-test-result"
193     # commit test result
194     - git add .
195     - git commit . -m "update test result for $CI_PROJECT_NAME/$CI_BUILD_REF_NAME/$CI_BUILD_REF, pipeline ID $CI_PIPELINE_ID" || exit 0
196     - git push origin master
197     - test "${TEST_RESULT}" = "Pass" || exit 1
198
199 push_master_to_github:
200   before_script:
201     - echo "Not setting up GitLab key, not fetching submodules"
202   stage: deploy
203   only:
204     - master
205   tags:
206     - deploy
207   when: on_success
208   image: espressif/esp32-ci-env
209   variables:
210     GIT_STRATEGY: clone
211   script:
212     - mkdir -p ~/.ssh
213     - chmod 700 ~/.ssh
214     - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
215     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
216     - chmod 600 ~/.ssh/id_rsa
217     - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
218     - git remote add github git@github.com:espressif/esp-idf.git
219     - git push --follow-tags github HEAD:master
220
221
222 deploy_docs:
223   before_script:
224     - echo "Not setting up GitLab key, not fetching submodules"
225   stage: deploy
226   only:
227    - master
228    - triggers
229   tags:
230     - deploy
231   image: espressif/esp32-ci-env
232   script:
233     - mkdir -p ~/.ssh
234     - chmod 700 ~/.ssh
235     - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
236     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
237     - chmod 600 ~/.ssh/id_rsa
238     - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
239     - export GIT_VER=$(git describe --always)
240     - cd docs/_build/
241     - mv html $GIT_VER
242     - tar czvf $GIT_VER.tar.gz $GIT_VER
243     - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH
244     - ssh $DOCS_SERVER -x "cd $DOCS_PATH && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
245
246
247 # AUTO GENERATED PART START, DO NOT MODIFY CONTENT BELOW
248 # template for test jobs
249 .test_template: &test_template
250   stage: test
251   when: on_success
252   only:
253     - master
254     - triggers
255   allow_failure: true
256
257   variables:
258     # LOCAL_ENV_CONFIG_PATH: define in template and jobs can overwrite if required
259     LOCAL_ENV_CONFIG_PATH: /home/gitlab-runner/LocalConfig/ESP32_IDF
260     BIN_PATH: "$CI_PROJECT_DIR/SSC/ssc_bin/SSC"
261     APP_NAME: "ssc"
262     LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
263     # append test level folder to TEST_CASE_FILE_PATH in before_script of test job
264     TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
265     # jobs MUST set CONFIG_FILE in before_script, and overwrite the variables above if necessary
266
267   artifacts:
268     when: always
269     paths:
270       - $LOG_PATH
271     expire_in: 6 mos
272
273   script:
274     # remove artifacts from last stage (UT logs)
275     - rm -rf $LOG_PATH
276     # add gitlab ssh key
277     - mkdir -p ~/.ssh
278     - chmod 700 ~/.ssh
279     - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
280     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
281     - chmod 600 ~/.ssh/id_rsa
282     - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
283     # clone test bench
284     - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
285     - cd auto_test_script
286     # run test
287     - 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
288
289
290 # template for overnight test jobs
291 .test_template_night: &test_template_night
292   <<: *test_template
293   only:
294     # can only be triggered
295     - triggers
296   script:
297     # remove artifacts from last stage (UT logs)
298     - rm -rf $LOG_PATH
299     # must be night build triggers, otherwise exit without test
300     - test $NIGHT_BUILD = "Yes" || exit 0
301     # add gitlab ssh key
302     - mkdir -p ~/.ssh
303     - chmod 700 ~/.ssh
304     - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
305     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
306     - chmod 600 ~/.ssh/id_rsa
307     - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
308     # clone test bench
309     - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
310     - cd auto_test_script
311     # run test
312     - 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
313
314 # template for unit test jobs
315 .unit_test_template: &unit_test_template
316   <<: *test_template
317   allow_failure: false
318   stage: unit_test
319
320   variables:
321     # jobs MUST set CONFIG_FILE in before_script, and overwrite the variables above if necessary
322     LOCAL_ENV_CONFIG_PATH: /home/gitlab-runner/LocalConfig/ESP32_IDF
323     BIN_PATH: "$CI_PROJECT_DIR/tools/unit-test-app/build/"
324     LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
325     APP_NAME: "ut"
326     TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/unit_test"
327
328 UT_Function_SYS_01:
329   <<: *unit_test_template
330   tags:
331     - ESP32_IDF
332     - UT_T1_1
333   before_script:
334     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/UT_Function_SYS_01.yml
335
336 IT_Function_SYS_01:
337   <<: *test_template
338   tags:
339     - ESP32_IDF
340     - SSC_T1_1
341   before_script:
342     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_SYS_01.yml
343
344 IT_Function_WIFI_01:
345   <<: *test_template
346   tags:
347     - ESP32_IDF
348     - SSC_T1_1
349     - SSC_T2_1
350   before_script:
351     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_01.yml
352
353 IT_Function_WIFI_02:
354   <<: *test_template
355   tags:
356     - ESP32_IDF
357     - SSC_T1_1
358     - SSC_T2_1
359   before_script:
360     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_02.yml
361
362 IT_Function_TCPIP_01:
363   <<: *test_template
364   tags:
365     - ESP32_IDF
366     - SSC_T1_1
367     - SSC_T2_1
368   before_script:
369     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_01.yml
370
371 IT_Function_TCPIP_02:
372   <<: *test_template
373   tags:
374     - ESP32_IDF
375     - SSC_T1_1
376   before_script:
377     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_02.yml
378
379 IT_Function_TCPIP_03:
380   <<: *test_template
381   tags:
382     - ESP32_IDF
383     - SSC_T1_1
384     - SSC_T2_1
385   before_script:
386     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_03.yml
387
388 IT_Function_TCPIP_04:
389   <<: *test_template
390   tags:
391     - ESP32_IDF
392     - SSC_T1_1
393     - SSC_T2_1
394   before_script:
395     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_04.yml
396
397 IT_Function_TCPIP_05:
398   <<: *test_template
399   tags:
400     - ESP32_IDF
401     - SSC_T1_1
402   before_script:
403     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_05.yml
404
405 IT_Stress_WIFI_01:
406   <<: *test_template_night
407   tags:
408     - ESP32_IDF
409     - SSC_T5_1
410   before_script:
411     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_WIFI_01.yml
412
413 IT_Stress_TCPIP_01:
414   <<: *test_template_night
415   tags:
416     - ESP32_IDF
417     - SSC_T1_1
418   before_script:
419     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_01.yml
420
421 IT_Stress_TCPIP_02:
422   <<: *test_template_night
423   tags:
424     - ESP32_IDF
425     - SSC_T2_1
426   before_script:
427     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_02.yml
428
429 IT_Stress_TCPIP_03:
430   <<: *test_template_night
431   tags:
432     - ESP32_IDF
433     - SSC_T1_1
434   before_script:
435     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_03.yml
436
437 IT_Stress_TCPIP_04:
438   <<: *test_template_night
439   tags:
440     - ESP32_IDF
441     - SSC_T2_1
442   before_script:
443     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_04.yml
444
445 IT_Stable_TCPIP_01:
446   <<: *test_template_night
447   tags:
448     - ESP32_IDF
449     - SSC_T5_1
450   before_script:
451     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stable_TCPIP_01.yml
452
453 IT_Stable_TCPIP_02:
454   <<: *test_template_night
455   tags:
456     - ESP32_IDF
457     - SSC_T1_1
458   before_script:
459     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stable_TCPIP_02.yml
460
461 IT_Stable_TCPIP_03:
462   <<: *test_template_night
463   tags:
464     - ESP32_IDF
465     - SSC_T5_1
466   before_script:
467     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stable_TCPIP_03.yml
468
469 IT_Function_TCPIP_06:
470   <<: *test_template_night
471   tags:
472     - ESP32_IDF
473     - SSC_T1_1
474   before_script:
475     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_06.yml
476
477 IT_Function_WIFI_03:
478   <<: *test_template
479   tags:
480     - ESP32_IDF
481     - SSC_T1_APC
482   before_script:
483     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_03.yml
484
485 IT_Function_WIFI_04:
486   <<: *test_template
487   tags:
488     - ESP32_IDF
489     - SSC_T3_PhyMode
490   before_script:
491     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_04.yml
492
493 IT_Function_WIFI_05:
494   <<: *test_template
495   tags:
496     - ESP32_IDF
497     - SSC_T1_WEP
498   before_script:
499     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_05.yml
500
501 IT_Function_WIFI_06:
502   <<: *test_template
503   tags:
504     - ESP32_IDF
505     - SSC_T2_PhyMode
506   before_script:
507     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_06.yml
508
509 IT_Function_TCPIP_07:
510   <<: *test_template
511   tags:
512     - ESP32_IDF
513     - SSC_T1_1
514     - SSC_T1_2
515   before_script:
516     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_07.yml
517
518 IT_Function_TCPIP_08:
519   <<: *test_template
520   tags:
521     - ESP32_IDF
522     - SSC_T1_1
523     - SSC_T2_1
524   before_script:
525     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_08.yml
526
527 IT_Function_TCPIP_09:
528   <<: *test_template
529   tags:
530     - ESP32_IDF
531     - SSC_T1_1
532     - SSC_T1_2
533   before_script:
534     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_09.yml
535
536 IT_Function_TCPIP_10:
537   <<: *test_template
538   tags:
539     - ESP32_IDF
540     - SSC_T1_1
541     - SSC_T1_2
542   before_script:
543     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_10.yml
544
545 IT_Function_TCPIP_11:
546   <<: *test_template
547   tags:
548     - ESP32_IDF
549     - SSC_T1_1
550   before_script:
551     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_11.yml
552
553 IT_Function_TCPIP_12:
554   <<: *test_template
555   tags:
556     - ESP32_IDF
557     - SSC_T1_1
558   before_script:
559     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_12.yml
560