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