]> granicus.if.org Git - esp-idf/blob - .gitlab-ci.yml
Merge branch 'bugfix/uart_argument_names' 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 libs.
18   # if testing other branches, use gitlab wifi 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%ssh://git@gitlab.espressif.cn:27227/idf/esp32-wifi-lib%" .gitmodules
20   # fetch all submodules
21   - git submodule update --init --recursive
22
23 build_template_app:
24   stage: build
25   image: espressif/esp32-ci-env
26   tags:
27     - build
28
29   variables:
30     SDK_PATH: "$CI_PROJECT_DIR"
31     IDF_PATH: "$CI_PROJECT_DIR"
32     GIT_STRATEGY: clone
33
34   script:
35     - git clone https://github.com/espressif/esp-idf-template.git
36     - cd esp-idf-template
37     # Try to use the same branch name for esp-idf-template that we're
38     # using on esp-idf. If it doesn't exist then just stick to the default
39     # branch
40     - git checkout ${CI_BUILD_REF_NAME} || echo "Using esp-idf-template default branch..."
41     - make defconfig
42     # Test debug build (default)
43     - make all V=1
44     # Now test release build
45     - make clean
46     - sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
47     - make defconfig
48     - make all V=1
49     # Check if there are any stray printf/ets_printf references in WiFi libs
50     - cd ../components/esp32/lib
51     - test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
52     - test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0
53
54
55 .build_gitlab: &build_template
56   stage: build
57   tags:
58     - build
59   image: espressif/esp32-ci-env
60
61   variables:
62     SDK_PATH: "$CI_PROJECT_DIR"
63     IDF_PATH: "$CI_PROJECT_DIR"
64     GIT_STRATEGY: clone
65
66 build_ssc:
67   <<: *build_template
68   artifacts:
69     paths:
70       - ./SSC/ssc_bin
71     expire_in: 6 mos
72
73   script:
74     - git clone $GITLAB_SSH_SERVER/yinling/SSC.git
75     - cd SSC
76     - git checkout ${CI_BUILD_REF_NAME} || echo "Using SSC default branch..."
77     - make defconfig
78     - chmod +x gen_misc_ng.sh
79     - ./gen_misc_ng.sh
80
81 build_esp_idf_tests:
82   <<: *build_template
83   artifacts:
84     paths:
85       - ./tools/unit-test-app/build/*.bin
86       - ./tools/unit-test-app/build/*.elf
87       - ./tools/unit-test-app/build/*.map
88       - ./tools/unit-test-app/build/bootloader/*.bin
89     expire_in: 6 mos
90
91   script:
92     - cd tools/unit-test-app
93     - git checkout ${CI_BUILD_REF_NAME} || echo "Using default branch..."
94     - make defconfig
95     - make TESTS_ALL=1
96
97 build_examples:
98   <<: *build_template
99   artifacts:
100     paths:
101       - build_examples/*/*/build/*.bin
102       - build_examples/*/*/build/*.elf
103       - build_examples/*/*/build/*.map
104       - build_examples/*/*/build/bootloader/*.bin
105     expire_in: 6 mos
106
107   script:
108     # it's not possible to build 100% out-of-tree and have the "artifacts"
109     # mechanism work, but this is the next best thing
110     - mkdir build_examples
111     - cd build_examples
112     - ${IDF_PATH}/make/build_examples.sh
113
114 build_docs:
115   stage: build
116   image: espressif/esp32-ci-env
117   tags:
118     - build_docs
119   script:
120     - cd docs
121     - doxygen
122     # If not building master branch, and there are Doxygen warnings, print them and bail out
123     - 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 )
124     - make html
125   artifacts:
126     paths:
127       - docs/_build/html
128     expire_in: 1 mos
129
130
131 test_nvs_on_host:
132   stage: test
133   image: espressif/esp32-ci-env
134   tags:
135     - nvs_host_test
136   script:
137     - cd components/nvs_flash/test_nvs_host
138     - make test
139
140 test_build_system:
141   stage: test
142   image: espressif/esp32-ci-env
143   tags:
144     - build_test
145   variables:
146     IDF_PATH: "$CI_PROJECT_DIR"
147   script:
148     - ./make/test_build_system.sh
149
150 test_report:
151   stage: test_report
152   only:
153     - master
154     - triggers
155   tags:
156     - test_report
157   variables:
158     LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
159     TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test"
160     REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report"
161   artifacts:
162     when: always
163     paths:
164       - $REPORT_PATH
165       - $LOG_PATH
166     expire_in: 12 mos
167   script:
168     # clone test bench
169     - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
170     - cd auto_test_script
171     # generate report
172     - python CITestReport.py -l $LOG_PATH -t $TEST_CASE_FILE_PATH -p $REPORT_PATH
173
174
175 push_master_to_github:
176   before_script:
177     - echo "Not setting up GitLab key, not fetching submodules"
178   stage: deploy
179   only:
180     - master
181   tags:
182     - deploy
183   when: on_success
184   image: espressif/esp32-ci-env
185   variables:
186     GIT_STRATEGY: clone
187   script:
188     - mkdir -p ~/.ssh
189     - chmod 700 ~/.ssh
190     - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
191     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
192     - chmod 600 ~/.ssh/id_rsa
193     - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
194     - git remote add github git@github.com:espressif/esp-idf.git
195     - git push --follow-tags github HEAD:master
196
197
198 deploy_docs:
199   before_script:
200     - echo "Not setting up GitLab key, not fetching submodules"
201   stage: deploy
202   only:
203    - master
204    - triggers
205   tags:
206     - deploy
207   image: espressif/esp32-ci-env
208   script:
209     - mkdir -p ~/.ssh
210     - chmod 700 ~/.ssh
211     - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
212     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
213     - chmod 600 ~/.ssh/id_rsa
214     - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
215     - export GIT_VER=$(git describe --always)
216     - cd docs/_build/
217     - mv html $GIT_VER
218     - tar czvf $GIT_VER.tar.gz $GIT_VER
219     - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH
220     - ssh $DOCS_SERVER -x "cd $DOCS_PATH && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
221
222
223 # AUTO GENERATED PART START, DO NOT MODIFY CONTENT BELOW
224 # template for test jobs
225 .test_template: &test_template
226   stage: test
227   when: on_success
228   only:
229     - master
230     - triggers
231   allow_failure: true
232
233   variables:
234     # LOCAL_ENV_CONFIG_PATH: define in template and jobs can overwrite if required
235     LOCAL_ENV_CONFIG_PATH: /home/gitlab-runner/LocalConfig/ESP32_IDF
236     BIN_PATH: "$CI_PROJECT_DIR/SSC/ssc_bin/SSC"
237     APP_NAME: "ssc"
238     LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
239     # append test level folder to TEST_CASE_FILE_PATH in before_script of test job
240     TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
241     # jobs MUST set CONFIG_FILE in before_script, and overwrite the variables above if necessary
242
243   artifacts:
244     when: always
245     paths:
246       - $LOG_PATH
247     expire_in: 6 mos
248
249   script:
250     # add gitlab ssh key
251     - mkdir -p ~/.ssh
252     - chmod 700 ~/.ssh
253     - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
254     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
255     - chmod 600 ~/.ssh/id_rsa
256     - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
257     # clone test bench
258     - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
259     - cd auto_test_script
260     # run test
261     - 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
262
263
264 # template for overnight test jobs
265 .test_template_night: &test_template_night
266   <<: *test_template
267   only:
268     # can only be triggered
269     - triggers
270   script:
271     # must be night build triggers, otherwise exit without test
272     - test $NIGHT_BUILD = "Yes" || exit 0
273     # add gitlab ssh key
274     - mkdir -p ~/.ssh
275     - chmod 700 ~/.ssh
276     - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
277     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
278     - chmod 600 ~/.ssh/id_rsa
279     - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
280     # clone test bench
281     - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
282     - cd auto_test_script
283     # run test
284     - 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
285
286 # template for unit test jobs
287 .unit_test_template: &unit_test_template
288   <<: *test_template
289   allow_failure: false
290   stage: unit_test
291
292   variables:
293     # jobs MUST set CONFIG_FILE in before_script, and overwrite the variables above if necessary
294     LOCAL_ENV_CONFIG_PATH: /home/gitlab-runner/LocalConfig/ESP32_IDF
295     BIN_PATH: "$CI_PROJECT_DIR/tools/unit-test-app/build/"
296     LOG_PATH: "$CI_PROJECT_DIR/$CI_BUILD_REF"
297     APP_NAME: "ut"
298     TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/unit_test"
299
300 UT_Function_SYS_01:
301   <<: *unit_test_template
302   tags:
303     - ESP32_IDF
304     - UT_T1_1
305   before_script:
306     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/UT_Function_SYS_01.yml
307
308 IT_Function_SYS_01:
309   <<: *test_template
310   tags:
311     - ESP32_IDF
312     - SSC_T1_1
313   before_script:
314     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_SYS_01.yml
315
316 IT_Function_WIFI_01:
317   <<: *test_template
318   tags:
319     - ESP32_IDF
320     - SSC_T1_1
321     - SSC_T2_1
322   before_script:
323     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_01.yml
324
325 IT_Function_WIFI_02:
326   <<: *test_template
327   tags:
328     - ESP32_IDF
329     - SSC_T1_1
330     - SSC_T2_1
331   before_script:
332     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_02.yml
333
334 IT_Function_TCPIP_01:
335   <<: *test_template
336   tags:
337     - ESP32_IDF
338     - SSC_T1_1
339     - SSC_T2_1
340   before_script:
341     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_01.yml
342
343 IT_Function_TCPIP_02:
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_TCPIP_02.yml
351
352 IT_Function_TCPIP_03:
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_TCPIP_03.yml
360
361 IT_Function_TCPIP_04:
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_04.yml
369
370 IT_Function_TCPIP_05:
371   <<: *test_template
372   tags:
373     - ESP32_IDF
374     - SSC_T1_1
375     - SSC_T2_1
376   before_script:
377     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_05.yml
378
379 IT_Function_TCPIP_06:
380   <<: *test_template_night
381   tags:
382     - ESP32_IDF
383     - SSC_T1_1
384   before_script:
385     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_06.yml
386
387 IT_Function_WIFI_03:
388   <<: *test_template
389   tags:
390     - ESP32_IDF
391     - SSC_T3_PhyMode
392   before_script:
393     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_03.yml
394
395 IT_Function_WIFI_04:
396   <<: *test_template
397   tags:
398     - ESP32_IDF
399     - SSC_T1_APC
400   before_script:
401     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_04.yml
402
403 IT_Function_WIFI_05:
404   <<: *test_template
405   tags:
406     - ESP32_IDF
407     - SSC_T1_WEP
408   before_script:
409     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_05.yml
410
411 IT_Function_WIFI_06:
412   <<: *test_template
413   tags:
414     - ESP32_IDF
415     - SSC_T2_PhyMode
416   before_script:
417     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_WIFI_06.yml
418
419 IT_Function_TCPIP_07:
420   <<: *test_template
421   tags:
422     - ESP32_IDF
423     - SSC_T1_1
424     - SSC_T1_2
425     - SSC_T2_1
426   before_script:
427     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_07.yml
428
429 IT_Function_TCPIP_08:
430   <<: *test_template
431   tags:
432     - ESP32_IDF
433     - SSC_T1_1
434   before_script:
435     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_08.yml
436
437 IT_Function_TCPIP_09:
438   <<: *test_template
439   tags:
440     - ESP32_IDF
441     - SSC_T1_1
442   before_script:
443     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_09.yml
444
445 IT_Function_TCPIP_10:
446   <<: *test_template
447   tags:
448     - ESP32_IDF
449     - SSC_T1_1
450     - SSC_T1_2
451     - SSC_T2_1
452   before_script:
453     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_10.yml
454
455 IT_Function_TCPIP_11:
456   <<: *test_template
457   tags:
458     - ESP32_IDF
459     - SSC_T1_1
460     - SSC_T1_2
461   before_script:
462     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_11.yml
463
464 IT_Function_TCPIP_12:
465   <<: *test_template
466   tags:
467     - ESP32_IDF
468     - SSC_T1_1
469   before_script:
470     - CONFIG_FILE=$TEST_CASE_FILE_PATH/CIConfigs/IT_Function_TCPIP_12.yml