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