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