]> granicus.if.org Git - esp-idf/blob - .gitlab-ci.yml
Merge branch 'bugfix/make_erase_flash' 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   only:
154     - master
155     - triggers
156   tags:
157     - test_report
158   variables:
159     LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
160     TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test"
161     REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report"
162   artifacts:
163     when: always
164     paths:
165       - $REPORT_PATH
166       - $LOG_PATH
167     expire_in: 12 mos
168   script:
169     # clone test bench
170     - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
171     - cd auto_test_script
172     # generate report
173     - python CITestReport.py -l $LOG_PATH -t $TEST_CASE_FILE_PATH -p $REPORT_PATH
174
175
176 push_master_to_github:
177   before_script:
178     - echo "Not setting up GitLab key, not fetching submodules"
179   stage: deploy
180   only:
181     - master
182   tags:
183     - deploy
184   when: on_success
185   image: espressif/esp32-ci-env
186   variables:
187     GIT_STRATEGY: clone
188   script:
189     - mkdir -p ~/.ssh
190     - chmod 700 ~/.ssh
191     - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
192     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
193     - chmod 600 ~/.ssh/id_rsa
194     - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
195     - git remote add github git@github.com:espressif/esp-idf.git
196     - git push --follow-tags github HEAD:master
197
198
199 deploy_docs:
200   before_script:
201     - echo "Not setting up GitLab key, not fetching submodules"
202   stage: deploy
203   only:
204    - master
205    - triggers
206   tags:
207     - deploy
208   image: espressif/esp32-ci-env
209   script:
210     - mkdir -p ~/.ssh
211     - chmod 700 ~/.ssh
212     - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
213     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
214     - chmod 600 ~/.ssh/id_rsa
215     - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
216     - export GIT_VER=$(git describe --always)
217     - cd docs/_build/
218     - mv html $GIT_VER
219     - tar czvf $GIT_VER.tar.gz $GIT_VER
220     - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH
221     - ssh $DOCS_SERVER -x "cd $DOCS_PATH && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
222
223
224 # AUTO GENERATED PART START, DO NOT MODIFY CONTENT BELOW
225 # template for test jobs
226 .test_template: &test_template
227   stage: test
228   when: on_success
229   only:
230     - master
231     - triggers
232   allow_failure: true
233
234   variables:
235     # LOCAL_ENV_CONFIG_PATH: define in template and jobs can overwrite if required
236     LOCAL_ENV_CONFIG_PATH: /home/gitlab-runner/LocalConfig/ESP32_IDF
237     BIN_PATH: "$CI_PROJECT_DIR/SSC/ssc_bin/SSC"
238     APP_NAME: "ssc"
239     LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
240     # append test level folder to TEST_CASE_FILE_PATH in before_script of test job
241     TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
242     # jobs MUST set CONFIG_FILE in before_script, and overwrite the variables above if necessary
243
244   artifacts:
245     when: always
246     paths:
247       - $LOG_PATH
248     expire_in: 6 mos
249
250   script:
251     # remove artifacts from last stage (UT logs)
252     - rm -rf $LOG_PATH
253     # add gitlab ssh key
254     - mkdir -p ~/.ssh
255     - chmod 700 ~/.ssh
256     - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
257     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
258     - chmod 600 ~/.ssh/id_rsa
259     - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
260     # clone test bench
261     - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
262     - cd auto_test_script
263     # run test
264     - 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
265
266
267 # template for overnight test jobs
268 .test_template_night: &test_template_night
269   <<: *test_template
270   only:
271     # can only be triggered
272     - triggers
273   script:
274     # remove artifacts from last stage (UT logs)
275     - rm -rf $LOG_PATH
276     # must be night build triggers, otherwise exit without test
277     - test $NIGHT_BUILD = "Yes" || exit 0
278     # add gitlab ssh key
279     - mkdir -p ~/.ssh
280     - chmod 700 ~/.ssh
281     - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
282     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
283     - chmod 600 ~/.ssh/id_rsa
284     - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
285     # clone test bench
286     - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
287     - cd auto_test_script
288     # run test
289     - 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
290
291 # template for unit test jobs
292 .unit_test_template: &unit_test_template
293   <<: *test_template
294   allow_failure: false
295   stage: unit_test
296
297   variables:
298     # jobs MUST set CONFIG_FILE in before_script, and overwrite the variables above if necessary
299     LOCAL_ENV_CONFIG_PATH: /home/gitlab-runner/LocalConfig/ESP32_IDF
300     BIN_PATH: "$CI_PROJECT_DIR/tools/unit-test-app/build/"
301     LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
302     APP_NAME: "ut"
303     TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/unit_test"
304
305 UT_Function_SYS_01:
306   <<: *unit_test_template
307   tags:
308     - ESP32_IDF
309     - UT_T1_1
310   before_script:
311     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/UT_Function_SYS_01.yml
312
313 IT_Function_SYS_01:
314   <<: *test_template
315   tags:
316     - ESP32_IDF
317     - SSC_T1_1
318   before_script:
319     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_SYS_01.yml
320
321 IT_Function_WIFI_01:
322   <<: *test_template
323   tags:
324     - ESP32_IDF
325     - SSC_T1_1
326     - SSC_T2_1
327   before_script:
328     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_01.yml
329
330 IT_Function_WIFI_02:
331   <<: *test_template
332   tags:
333     - ESP32_IDF
334     - SSC_T1_1
335     - SSC_T2_1
336   before_script:
337     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_02.yml
338
339 IT_Function_TCPIP_01:
340   <<: *test_template
341   tags:
342     - ESP32_IDF
343     - SSC_T1_1
344     - SSC_T2_1
345   before_script:
346     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_01.yml
347
348 IT_Function_TCPIP_02:
349   <<: *test_template
350   tags:
351     - ESP32_IDF
352     - SSC_T1_1
353   before_script:
354     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_02.yml
355
356 IT_Function_TCPIP_03:
357   <<: *test_template
358   tags:
359     - ESP32_IDF
360     - SSC_T1_1
361     - SSC_T2_1
362   before_script:
363     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_03.yml
364
365 IT_Function_TCPIP_04:
366   <<: *test_template
367   tags:
368     - ESP32_IDF
369     - SSC_T1_1
370     - SSC_T2_1
371   before_script:
372     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_04.yml
373
374 IT_Function_TCPIP_05:
375   <<: *test_template
376   tags:
377     - ESP32_IDF
378     - SSC_T1_1
379   before_script:
380     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_05.yml
381
382 IT_Stress_WIFI_01:
383   <<: *test_template_night
384   tags:
385     - ESP32_IDF
386     - SSC_T5_1
387   before_script:
388     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_WIFI_01.yml
389
390 IT_Stress_TCPIP_01:
391   <<: *test_template_night
392   tags:
393     - ESP32_IDF
394     - SSC_T1_1
395   before_script:
396     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_01.yml
397
398 IT_Stress_TCPIP_02:
399   <<: *test_template_night
400   tags:
401     - ESP32_IDF
402     - SSC_T2_1
403   before_script:
404     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_02.yml
405
406 IT_Stress_TCPIP_03:
407   <<: *test_template_night
408   tags:
409     - ESP32_IDF
410     - SSC_T1_1
411   before_script:
412     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_03.yml
413
414 IT_Stress_TCPIP_04:
415   <<: *test_template_night
416   tags:
417     - ESP32_IDF
418     - SSC_T2_1
419   before_script:
420     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stress_TCPIP_04.yml
421
422 IT_Stable_TCPIP_01:
423   <<: *test_template_night
424   tags:
425     - ESP32_IDF
426     - SSC_T5_1
427   before_script:
428     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stable_TCPIP_01.yml
429
430 IT_Stable_TCPIP_02:
431   <<: *test_template_night
432   tags:
433     - ESP32_IDF
434     - SSC_T1_1
435   before_script:
436     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stable_TCPIP_02.yml
437
438 IT_Stable_TCPIP_03:
439   <<: *test_template_night
440   tags:
441     - ESP32_IDF
442     - SSC_T5_1
443   before_script:
444     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Stable_TCPIP_03.yml
445
446 IT_Function_TCPIP_06:
447   <<: *test_template_night
448   tags:
449     - ESP32_IDF
450     - SSC_T1_1
451   before_script:
452     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_06.yml
453
454 IT_Function_WIFI_03:
455   <<: *test_template
456   tags:
457     - ESP32_IDF
458     - SSC_T1_APC
459   before_script:
460     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_03.yml
461
462 IT_Function_WIFI_04:
463   <<: *test_template
464   tags:
465     - ESP32_IDF
466     - SSC_T3_PhyMode
467   before_script:
468     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_04.yml
469
470 IT_Function_WIFI_05:
471   <<: *test_template
472   tags:
473     - ESP32_IDF
474     - SSC_T1_WEP
475   before_script:
476     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_05.yml
477
478 IT_Function_WIFI_06:
479   <<: *test_template
480   tags:
481     - ESP32_IDF
482     - SSC_T2_PhyMode
483   before_script:
484     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_06.yml
485
486 IT_Function_TCPIP_07:
487   <<: *test_template
488   tags:
489     - ESP32_IDF
490     - SSC_T1_1
491     - SSC_T1_2
492   before_script:
493     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_07.yml
494
495 IT_Function_TCPIP_08:
496   <<: *test_template
497   tags:
498     - ESP32_IDF
499     - SSC_T1_1
500     - SSC_T2_1
501   before_script:
502     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_08.yml
503
504 IT_Function_TCPIP_09:
505   <<: *test_template
506   tags:
507     - ESP32_IDF
508     - SSC_T1_1
509     - SSC_T1_2
510   before_script:
511     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_09.yml
512
513 IT_Function_TCPIP_10:
514   <<: *test_template
515   tags:
516     - ESP32_IDF
517     - SSC_T1_1
518     - SSC_T1_2
519   before_script:
520     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_10.yml
521
522 IT_Function_TCPIP_11:
523   <<: *test_template
524   tags:
525     - ESP32_IDF
526     - SSC_T1_1
527   before_script:
528     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_11.yml
529
530 IT_Function_TCPIP_12:
531   <<: *test_template
532   tags:
533     - ESP32_IDF
534     - SSC_T1_1
535   before_script:
536     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_12.yml
537