]> granicus.if.org Git - esp-idf/blob - .gitlab-ci.yml
Merge branch 'feature/ci_fuzzer_tests_lwip' into 'master'
[esp-idf] / .gitlab-ci.yml
1 stages:
2   - build
3   - assign_test
4   - host_test
5   - unit_test
6   - integration_test
7   - deploy
8
9 variables:
10 # System environment
11
12   # Common parameters for the 'make' during CI tests
13   MAKEFLAGS: "-j5 --no-keep-going"
14
15 # GitLab-CI environment
16
17   # more attempts for more robust
18   GET_SOURCES_ATTEMPTS: "10"
19   ARTIFACT_DOWNLOAD_ATTEMPTS: "10"
20
21   # We use get_sources.sh script to fetch the submodules and/or re-fetch the repo
22   # if it was corrupted (if submodule update fails this can happen)
23   GIT_STRATEGY: fetch
24   GIT_SUBMODULE_STRATEGY: none
25
26 # IDF environment
27
28   IDF_PATH: "$CI_PROJECT_DIR"
29   BATCH_BUILD: "1"
30   V: "0"
31   APPLY_BOT_FILTER_SCRIPT: "$CI_PROJECT_DIR/tools/ci/apply_bot_filter.py"
32   CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
33
34 # When 'fetch' strategy is used, Gitlab removes untracked files before checking out
35 # new revision. However if the new revision doesn't include some of the submodules
36 # which were present in the old revision, such submodule directories would not be
37 # removed by the checkout. This extra step ensures that these stale submodules
38 # are removed.
39 .git_clean_stale_submodules:  &git_clean_stale_submodules >
40   find . -name '.git' -not -path './.git' -printf '%P\n'
41   | sed 's|/.git||' 
42   | xargs -I {} sh -c '
43   grep -q {} .gitmodules 
44   ||  (echo "Removing {}, has .git directory but not in .gitmodules file" 
45   && rm -rf {});'
46
47 # before each job, we need to check if this job is filtered by bot stage/job filter
48 .apply_bot_filter: &apply_bot_filter
49   python $APPLY_BOT_FILTER_SCRIPT || exit 0
50
51 before_script:
52   - *git_clean_stale_submodules
53   # apply bot filter in before script
54   - *apply_bot_filter
55   # add gitlab ssh key
56   - mkdir -p ~/.ssh
57   - chmod 700 ~/.ssh
58   - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
59   - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
60   - chmod 600 ~/.ssh/id_rsa
61   - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
62
63   # Set IS_PRIVATE or IS_PUBLIC depending on if our branch is public or not
64   #
65   # (the same regular expressions are used to set these are used in 'only:' sections below
66   - source tools/ci/configure_ci_environment.sh
67
68   # fetch the submodules (& if necessary re-fetch repo) from gitlab
69   - time ./tools/ci/get-full-sources.sh
70
71 .do_nothing_before:
72   before_script: &do_nothing_before
73     - *git_clean_stale_submodules
74     # apply bot filter in before script
75     - *apply_bot_filter
76     - echo "Not setting up GitLab key, not fetching submodules"
77     - source tools/ci/configure_ci_environment.sh
78
79 .add_gitlab_key_before:
80   before_script: &add_gitlab_key_before
81     - *git_clean_stale_submodules
82     # apply bot filter in before script
83     - *apply_bot_filter
84     - echo "Not fetching submodules"
85     - source tools/ci/configure_ci_environment.sh
86     # add gitlab ssh key
87     - mkdir -p ~/.ssh
88     - chmod 700 ~/.ssh
89     - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
90     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
91     - chmod 600 ~/.ssh/id_rsa
92     - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
93
94 build_template_app:
95   stage: build
96   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
97   tags:
98     - build
99   variables:
100     BATCH_BUILD: "1"
101     IDF_CI_BUILD: "1"
102   script:
103     - git clone https://github.com/espressif/esp-idf-template.git
104     - cd esp-idf-template
105     # Try to use the same branch name for esp-idf-template that we're
106     # using on esp-idf. If it doesn't exist then just stick to the default
107     # branch
108     - python $CHECKOUT_REF_SCRIPT esp-idf-template
109     # Test debug build (default)
110     - make all V=1
111     # Now test release build
112     - make clean
113     - sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
114     - make all V=1
115     # Check if there are any stray printf/ets_printf references in WiFi libs
116     - cd ../components/esp32/lib
117     - test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
118     - test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0
119
120
121 .build_template: &build_template
122   stage: build
123   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
124   tags:
125     - build
126   variables:
127     BATCH_BUILD: "1"
128     V: "0"
129
130 .build_ssc_template: &build_ssc_template
131   <<: *build_template
132   artifacts:
133     paths:
134       - SSC/ssc_bin
135     expire_in: 1 mos
136   variables:
137     SSC_CONFIG_FOLDER: "$CI_PROJECT_DIR/SSC/configs/ESP32_IDF"
138   script:
139     - git clone $SSC_REPOSITORY
140     - cd SSC
141     - python $CHECKOUT_REF_SCRIPT SSC
142     - MAKEFLAGS= ./ci_build_ssc.sh "${CI_JOB_NAME}" "${IDF_PATH}/.gitlab-ci.yml"
143
144 # don't forget to add to dependency to test_template when adding new build_ssc jobs
145 build_ssc_00:
146   <<: *build_ssc_template
147
148 build_ssc_01:
149   <<: *build_ssc_template
150
151 build_ssc_02:
152   <<: *build_ssc_template
153
154 # If you want to add new build ssc jobs, please add it into dependencies of `assign_test` and `.test_template`
155
156 build_esp_idf_tests:
157   <<: *build_template
158   artifacts:
159     paths:
160       - tools/unit-test-app/output
161       - components/idf_test/unit_test/TestCaseAll.yml
162       - components/idf_test/unit_test/CIConfigs/*.yml
163     expire_in: 1 mos
164   script:
165     - cd tools/unit-test-app
166     - MAKEFLAGS= make help # make sure kconfig tools are built in single process
167     - make ut-clean-all-configs
168     - export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
169     - export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
170     - make ut-build-all-configs
171     - python tools/UnitTestParser.py
172
173 .build_examples_template: &build_examples_template
174   <<: *build_template
175   retry: 1
176   artifacts:
177     when: always
178     paths:
179       - build_examples/*/*/*/build/*.bin
180       - build_examples/*/*/*/build/*.elf
181       - build_examples/*/*/*/build/*.map
182       - build_examples/*/*/*/build/download.config
183       - build_examples/*/*/*/build/bootloader/*.bin
184       - $LOG_PATH
185     expire_in: 1 week
186   variables:
187     IDF_CI_BUILD: "1"
188     LOG_PATH: "$CI_PROJECT_DIR/log_examples"
189   script:
190     # it's not possible to build 100% out-of-tree and have the "artifacts"
191     # mechanism work, but this is the next best thing
192     - rm -rf build_examples
193     - mkdir build_examples
194     - cd build_examples
195     # build some of examples
196     - mkdir -p ${LOG_PATH}
197     - ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
198
199 build_examples_00:
200   <<: *build_examples_template
201
202 build_examples_01:
203   <<: *build_examples_template
204
205 build_examples_02:
206   <<: *build_examples_template
207
208 build_examples_03:
209   <<: *build_examples_template
210
211 build_examples_04:
212   <<: *build_examples_template
213
214 build_examples_05:
215   <<: *build_examples_template
216
217 build_examples_06:
218   <<: *build_examples_template
219
220 build_examples_07:
221   <<: *build_examples_template
222
223 # If you want to add new build example jobs, please add it into dependencies of `.example_test_template`
224
225 build_docs:
226   stage: build
227   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
228   tags:
229     - build_docs
230   artifacts:
231     when: always
232     paths:
233       # English version of documentation
234       - docs/en/doxygen-warning-log.txt
235       - docs/en/sphinx-warning-log.txt
236       - docs/en/sphinx-warning-log-sanitized.txt
237       - docs/en/_build/html
238       # Chinese version of documentation
239       - docs/zh_CN/doxygen-warning-log.txt
240       - docs/zh_CN/sphinx-warning-log.txt
241       - docs/zh_CN/sphinx-warning-log-sanitized.txt
242       - docs/zh_CN/_build/html
243     expire_in: 1 mos
244   script:
245     - cd docs
246     - ./check_lang_folder_sync.sh
247     - cd en
248     - make gh-linkcheck
249     - make html
250     - ../check_doc_warnings.sh
251     - cd ../zh_CN
252     - make gh-linkcheck
253     - make html
254     - ../check_doc_warnings.sh
255
256 .host_test_template: &host_test_template
257   stage: host_test
258   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
259   tags:
260     - host_test
261   dependencies: []
262     
263 test_nvs_on_host:
264   <<: *host_test_template
265   script:
266     - cd components/nvs_flash/test_nvs_host
267     - make test
268
269 test_nvs_coverage:
270   <<: *host_test_template
271   artifacts:
272     paths:
273       - components/nvs_flash/test_nvs_host/coverage_report
274   only:
275     - triggers
276   # This job takes a few hours to finish, so only run it on demand
277   variables:
278     BOT_NEEDS_TRIGGER_BY_NAME: 1
279   script:
280     - cd components/nvs_flash/test_nvs_host
281     - make coverage_report
282
283 test_partition_table_on_host:
284   <<: *host_test_template
285   tags:
286     - build
287   script:
288     - cd components/partition_table/test_gen_esp32part_host
289     - ./gen_esp32part_tests.py
290
291 test_wl_on_host:
292   <<: *host_test_template
293   artifacts:
294     paths:
295       - components/wear_levelling/test_wl_host/coverage_report.zip
296   script:
297     - cd components/wear_levelling/test_wl_host
298     - make test
299
300 test_fatfs_on_host:
301   <<: *host_test_template
302   script:
303     - cd components/fatfs/test_fatfs_host/
304     - make test
305
306 .host_fuzzer_test_template: &host_fuzzer_test_template
307   stage: host_test
308   image: $CI_DOCKER_REGISTRY/afl-fuzzer-test
309   tags:
310     - host_test
311   dependencies: []
312   artifacts:
313     when: always
314     paths:
315       - ${FUZZER_TEST_DIR}/out/crashes
316       - ${FUZZER_TEST_DIR}/fuzz_output.log
317     expire_in: 1 mos
318   only:
319     # can only be triggered
320     - triggers
321   variables:
322     BOT_NEEDS_TRIGGER_BY_NAME: 1
323   script:
324     - export AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 && export AFL_SKIP_CPUFREQ=1
325     - cd ${FUZZER_TEST_DIR}
326     # run AFL fuzzer for one hour
327     - ( ( make ${FUZZER_PARAMS} fuzz | tee fuzz_output.log | grep -v '\(Fuzzing test case\|Entering queue cycle\)' ) || pkill sleep ) &
328     - ( sleep 3600 || mkdir -p out/crashes/env_failed ) && pkill afl-fuz
329     # check no crashes found
330     - test -z "$(ls out/crashes/)" || exit 1
331
332 test_mdns_fuzzer_on_host:
333   <<: *host_fuzzer_test_template
334   variables:
335     FUZZER_TEST_DIR: components/mdns/test_afl_fuzz_host
336
337 test_lwip_dns_fuzzer_on_host:
338   <<: *host_fuzzer_test_template
339   variables:
340     FUZZER_TEST_DIR: components/lwip/test_afl_host
341     FUZZER_PARAMS: MODE=dns
342
343 test_lwip_dhcp_fuzzer_on_host:
344   <<: *host_fuzzer_test_template
345   variables:
346     FUZZER_TEST_DIR: components/lwip/test_afl_host
347     FUZZER_PARAMS: MODE=dhcp_client
348
349 test_lwip_dhcps_fuzzer_on_host:
350   <<: *host_fuzzer_test_template
351   variables:
352     FUZZER_TEST_DIR: components/lwip/test_afl_host
353     FUZZER_PARAMS: MODE=dhcp_server
354
355 test_spiffs_on_host:
356   <<: *host_test_template
357   script:
358     - cd components/spiffs/test_spiffs_host/
359     - make test
360
361 test_multi_heap_on_host:
362   <<: *host_test_template
363   script:
364     - cd components/heap/test_multi_heap_host
365     - ./test_all_configs.sh
366
367 test_build_system:
368   <<: *host_test_template
369   script:
370     - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
371     - rm -rf test_build_system
372     - mkdir test_build_system
373     - cd test_build_system
374     - ${IDF_PATH}/tools/ci/test_build_system.sh
375
376 test_idf_monitor:
377   <<: *host_test_template
378   artifacts:
379     when: on_failure
380     paths:
381       - tools/test_idf_monitor/outputs/*
382     expire_in: 1 week
383   script:
384     - cd ${IDF_PATH}/tools/test_idf_monitor
385     - source /opt/pyenv/activate
386     - pyenv global 2.7.15
387     - ./run_test_idf_monitor.py
388     - pyenv global 3.4.8
389     - ./run_test_idf_monitor.py
390     - pyenv global system
391
392 test_esp_err_to_name_on_host:
393   <<: *host_test_template
394   artifacts:
395     when: on_failure
396     paths:
397       - components/esp32/esp_err_to_name.c
398     expire_in: 1 week
399   script:
400     - cd tools/
401     - source /opt/pyenv/activate
402     - pyenv global 2.7.15
403     - ./gen_esp_err_to_name.py
404     - git diff --exit-code -- ../components/esp32/esp_err_to_name.c || (echo 'Differences found. Please run gen_esp_err_to_name.py and commit the changes.'; exit 1)
405     - pyenv global 3.4.8
406     - ./gen_esp_err_to_name.py
407     - git diff --exit-code -- ../components/esp32/esp_err_to_name.c || (echo 'Differences found between running under Python 2 and 3.'; exit 1)
408     - pyenv global system
409
410 push_to_github:
411   stage: deploy
412   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
413   tags:
414     - deploy
415   only:
416     - master
417     - /^release\/v/
418     - /^v\d+\.\d+(\.\d+)?($|-)/
419   when: on_success
420   dependencies: []
421   before_script: *do_nothing_before
422   script:
423     - mkdir -p ~/.ssh
424     - chmod 700 ~/.ssh
425     - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
426     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
427     - chmod 600 ~/.ssh/id_rsa
428     - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
429     - git remote remove github &>/dev/null || true
430     - git remote add github git@github.com:espressif/esp-idf.git
431     # Need separate push commands for tag builds and for branch builds
432     - "[ -n \"${CI_COMMIT_TAG}\" ] && git push github ${CI_COMMIT_TAG}"
433     - "[ -z \"${CI_COMMIT_TAG}\" ] && git push github ${CI_COMMIT_SHA}:refs/heads/${CI_COMMIT_REF_NAME}"
434
435 deploy_docs:
436   stage: host_test
437   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
438   tags:
439     - deploy
440   only:
441    - master
442    - /^release\/v/
443    - /^v\d+\.\d+(\.\d+)?($|-)/
444    - triggers
445   dependencies:
446     - build_docs
447   before_script: *do_nothing_before
448   script:
449     - mkdir -p ~/.ssh
450     - chmod 700 ~/.ssh
451     - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
452     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
453     - chmod 600 ~/.ssh/id_rsa
454     - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
455     - export GIT_VER=$(git describe --always)
456     - cd docs/en/_build/
457     - mv html $GIT_VER
458     - tar czvf $GIT_VER.tar.gz $GIT_VER
459     - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/en
460     - ssh $DOCS_SERVER -x "cd $DOCS_PATH/en && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
461     - cd ../../zh_CN/_build/
462     - mv html $GIT_VER
463     - tar czvf $GIT_VER.tar.gz $GIT_VER
464     - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/zh_CN
465     - ssh $DOCS_SERVER -x "cd $DOCS_PATH/zh_CN && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
466     # add link to preview doc
467     - echo "[document preview][en] $CI_DOCKER_REGISTRY/docs/esp-idf/en/${GIT_VER}/index.html"
468     - echo "[document preview][zh_CN] $CI_DOCKER_REGISTRY/docs/esp-idf/zh_CN/${GIT_VER}/index.html"
469
470 check_doc_links:
471   stage: host_test
472   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
473   tags:
474     - check_doc_links
475   only:
476     # can only be triggered
477     - triggers
478   artifacts:
479     paths:
480       - docs/_build/linkcheck
481     expire_in: 1 mos
482   script:
483     # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
484     - test "$CHECK_LINKS" = "Yes" || exit 0
485     # can only run on master branch (otherwise the commit is not on Github yet)
486     - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
487     - cd docs
488     - make linkcheck
489
490 check_line_endings:
491   stage: deploy
492   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
493   tags:
494     - build
495   except:
496     - master
497     - /^release\/v/
498     - /^v\d+\.\d+(\.\d+)?($|-)/
499   dependencies: []
500   before_script: *do_nothing_before
501   script:
502     - tools/ci/check-line-endings.sh ${IDF_PATH}
503
504 check_commit_msg:
505   stage: deploy
506   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
507   tags:
508     - build
509   except:
510     - master
511     - /^release\/v/
512     - /^v\d+\.\d+(\.\d+)?($|-)/
513   dependencies: []
514   before_script: *do_nothing_before
515   script:
516     - git status
517     - git log -n10 --oneline
518     # commit start with "WIP: " need to be squashed before merge
519     - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
520
521 check_permissions:
522   stage: deploy
523   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
524   tags:
525     - build
526   except:
527     - master
528     - /^release\/v/
529     - /^v\d+\.\d+(\.\d+)?($|-)/
530   dependencies: []
531   before_script: *do_nothing_before
532   script:
533     - tools/ci/check-executable.sh
534
535 check_submodule_sync:
536   stage: deploy
537   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
538   tags:
539     - build
540   except:
541     - master
542     - /^release\/v/
543     - /^v\d+\.\d+(\.\d+)?($|-)/
544   dependencies: []
545   variables:
546     GIT_STRATEGY: clone
547   before_script: *do_nothing_before
548   script:
549     # check if all submodules are correctly synced to public repostory
550     - git submodule update --init --recursive
551
552 assign_test:
553   tags:
554     - assign_test
555   image: $CI_DOCKER_REGISTRY/ubuntu-test-env
556   stage: assign_test
557   # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
558   # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
559   dependencies:
560     - build_ssc_00
561     - build_ssc_01
562     - build_ssc_02
563     - build_esp_idf_tests
564   variables:
565     TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
566     EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
567   artifacts:
568     paths:
569       - components/idf_test/*/CIConfigs
570       - components/idf_test/*/TC.sqlite
571       - $EXAMPLE_CONFIG_OUTPUT_PATH
572     expire_in: 1 mos
573   before_script: *add_gitlab_key_before
574   script:
575     # assign example tests
576     - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
577     # assign unit test cases
578     - python $TEST_FW_PATH/CIAssignUnitTest.py $IDF_PATH/components/idf_test/unit_test/TestCaseAll.yml $IDF_PATH/.gitlab-ci.yml $IDF_PATH/components/idf_test/unit_test/CIConfigs
579     # clone test script to assign tests
580     - git clone $TEST_SCRIPT_REPOSITORY
581     - cd auto_test_script
582     - python $CHECKOUT_REF_SCRIPT auto_test_script
583     # assgin integration test cases
584     - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
585
586 .example_test_template: &example_test_template
587   stage: integration_test
588   when: on_success
589   only:
590     - master
591     - /^release\/v/
592     - /^v\d+\.\d+(\.\d+)?($|-)/
593     - triggers
594     - schedules
595   dependencies:
596     - assign_test
597     - build_examples_00
598     - build_examples_01
599     - build_examples_02
600     - build_examples_03
601     - build_examples_04
602     - build_examples_05
603     - build_examples_06
604     - build_examples_07
605   artifacts:
606     when: always
607     paths:
608       - $LOG_PATH
609     expire_in: 1 mos
610   variables:
611     TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
612     TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
613     CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
614     LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
615     ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
616   script:
617     # first test if config file exists, if not exist, exit 0
618     - test -e $CONFIG_FILE || exit 0
619     # clone test env configs
620     - git clone $TEST_ENV_CONFIG_REPOSITORY
621     - cd ci-test-runner-configs
622     - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
623     - cd $TEST_FW_PATH
624     # run test
625     - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
626
627 .unit_test_template: &unit_test_template
628   <<: *example_test_template
629   stage: unit_test
630   dependencies:
631     - assign_test
632     - build_esp_idf_tests
633   variables:
634     TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
635     TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
636     CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
637     LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
638     ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
639
640 .test_template: &test_template
641   stage: integration_test
642   when: on_success
643   only:
644     - master
645     - /^release\/v/
646     - /^v\d+\.\d+(\.\d+)?($|-)/
647     - triggers
648     - schedules
649   dependencies:
650     - assign_test
651     - build_ssc_00
652     - build_ssc_01
653     - build_ssc_02
654   artifacts:
655     when: always
656     paths:
657       - $LOG_PATH
658     expire_in: 1 mos
659   variables:
660     LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
661     LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
662     TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
663     MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
664     CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
665   before_script: *add_gitlab_key_before
666   script:
667     # first test if config file exists, if not exist, exit 0
668     - test -e $CONFIG_FILE || exit 0
669     # clone local test env configs
670     - git clone $TEST_ENV_CONFIG_REPOSITORY
671     - cd ci-test-runner-configs
672     - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
673     # clone test bench
674     - git clone $TEST_SCRIPT_REPOSITORY
675     - cd auto_test_script
676     - python $CHECKOUT_REF_SCRIPT auto_test_script
677     # run test
678     - python CIRunner.py -l "$LOG_PATH/$CI_JOB_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH -m $MODULE_UPDATE_FILE
679
680 nvs_compatible_test:
681   <<: *test_template
682   artifacts:
683     when: always
684     paths:
685       - $LOG_PATH
686       - nvs_wifi.bin
687     expire_in: 1 mos
688   tags:
689     - ESP32_IDF
690     - NVS_Compatible
691   script:
692     # clone local test env configs
693     - git clone $TEST_ENV_CONFIG_REPOSITORY
694     - cd ci-test-runner-configs
695     - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
696     # clone test bench
697     - git clone $TEST_SCRIPT_REPOSITORY
698     - cd auto_test_script
699     - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
700     # prepare nvs bins
701     - ./Tools/prepare_nvs_bin.sh
702     # run test
703     - python CIRunner.py -l "$LOG_PATH/$CI_JOB_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH -m $MODULE_UPDATE_FILE
704
705 example_test_001_01:
706   <<: *example_test_template
707   tags:
708     - ESP32
709     - Example_WIFI
710
711 example_test_002_01:
712   <<: *example_test_template
713   tags:
714     - ESP32
715     - Example_ShieldBox
716
717 example_test_003_01:
718   <<: *example_test_template
719   tags:
720     - ESP32
721     - Example_SDIO
722
723 example_test_004_01:
724   <<: *example_test_template
725   tags:
726     - ESP32
727     - Example_CAN
728
729 UT_001_01:
730   <<: *unit_test_template
731   tags:
732     - ESP32_IDF
733     - UT_T1_1
734
735 UT_001_02:
736   <<: *unit_test_template
737   tags:
738     - ESP32_IDF
739     - UT_T1_1
740
741 UT_001_03:
742   <<: *unit_test_template
743   tags:
744     - ESP32_IDF
745     - UT_T1_1
746
747 UT_001_04:
748   <<: *unit_test_template
749   tags:
750     - ESP32_IDF
751     - UT_T1_1
752
753 UT_001_05:
754   <<: *unit_test_template
755   tags:
756     - ESP32_IDF
757     - UT_T1_1
758
759 UT_001_06:
760   <<: *unit_test_template
761   tags:
762     - ESP32_IDF
763     - UT_T1_1
764
765 UT_001_07:
766   <<: *unit_test_template
767   tags:
768     - ESP32_IDF
769     - UT_T1_1
770
771 UT_001_08:
772   <<: *unit_test_template
773   tags:
774     - ESP32_IDF
775     - UT_T1_1
776
777 UT_001_09:
778   <<: *unit_test_template
779   tags:
780     - ESP32_IDF
781     - UT_T1_1
782
783 UT_001_10:
784   <<: *unit_test_template
785   tags:
786     - ESP32_IDF
787     - UT_T1_1
788
789 UT_001_11:
790   <<: *unit_test_template
791   tags:
792     - ESP32_IDF
793     - UT_T1_1
794
795 UT_001_12:
796   <<: *unit_test_template
797   tags:
798     - ESP32_IDF
799     - UT_T1_1
800
801 UT_001_13:
802   <<: *unit_test_template
803   tags:
804     - ESP32_IDF
805     - UT_T1_1
806
807 UT_001_14:
808   <<: *unit_test_template
809   tags:
810     - ESP32_IDF
811     - UT_T1_1
812
813 UT_001_15:
814   <<: *unit_test_template
815   tags:
816     - ESP32_IDF
817     - UT_T1_1
818
819 UT_001_16:
820   <<: *unit_test_template
821   tags:
822     - ESP32_IDF
823     - UT_T1_1
824
825 UT_001_17:
826   <<: *unit_test_template
827   tags:
828     - ESP32_IDF
829     - UT_T1_1
830
831 UT_001_18:
832   <<: *unit_test_template
833   tags:
834     - ESP32_IDF
835     - UT_T1_1
836
837 UT_001_19:
838   <<: *unit_test_template
839   tags:
840     - ESP32_IDF
841     - UT_T1_1
842
843 UT_001_20:
844   <<: *unit_test_template
845   tags:
846     - ESP32_IDF
847     - UT_T1_1
848
849 UT_001_21:
850   <<: *unit_test_template
851   tags:
852     - ESP32_IDF
853     - UT_T1_1
854
855 UT_001_22:
856   <<: *unit_test_template
857   tags:
858     - ESP32_IDF
859     - UT_T1_1
860
861 UT_001_23:
862   <<: *unit_test_template
863   tags:
864     - ESP32_IDF
865     - UT_T1_1
866
867 UT_001_24:
868   <<: *unit_test_template
869   tags:
870     - ESP32_IDF
871     - UT_T1_1
872
873 UT_001_25:
874   <<: *unit_test_template
875   tags:
876     - ESP32_IDF
877     - UT_T1_1
878     
879 UT_001_26:
880   <<: *unit_test_template
881   tags:
882     - ESP32_IDF
883     - UT_T1_1
884
885 UT_001_27:
886   <<: *unit_test_template
887   tags:
888     - ESP32_IDF
889     - UT_T1_1
890
891 UT_001_28:
892   <<: *unit_test_template
893   tags:
894     - ESP32_IDF
895     - UT_T1_1
896
897 UT_001_29:
898   <<: *unit_test_template
899   tags:
900     - ESP32_IDF
901     - UT_T1_1
902
903 UT_001_30:
904   <<: *unit_test_template
905   tags:
906     - ESP32_IDF
907     - UT_T1_1
908
909 UT_001_31:
910   <<: *unit_test_template
911   tags:
912     - ESP32_IDF
913     - UT_T1_1
914     
915 UT_001_32:
916   <<: *unit_test_template
917   tags:
918     - ESP32_IDF
919     - UT_T1_1
920
921 UT_001_33:
922   <<: *unit_test_template
923   tags:
924     - ESP32_IDF
925     - UT_T1_1
926     
927 UT_001_34:
928   <<: *unit_test_template
929   tags:
930     - ESP32_IDF
931     - UT_T1_1
932
933 UT_001_35:
934   <<: *unit_test_template
935   tags:
936     - ESP32_IDF
937     - UT_T1_1
938
939 UT_001_36:
940   <<: *unit_test_template
941   tags:
942     - ESP32_IDF
943     - UT_T1_1
944
945 UT_002_01:
946   <<: *unit_test_template
947   tags:
948     - ESP32_IDF
949     - UT_T1_SDMODE
950
951 UT_002_02:
952   <<: *unit_test_template
953   tags:
954     - ESP32_IDF
955     - UT_T1_SDMODE
956
957 UT_002_03:
958   <<: *unit_test_template
959   tags:
960     - ESP32_IDF
961     - UT_T1_SDMODE
962
963 UT_003_01:
964   <<: *unit_test_template
965   tags:
966     - ESP32_IDF
967     - UT_T1_SPIMODE
968
969 UT_003_02:
970   <<: *unit_test_template
971   tags:
972     - ESP32_IDF
973     - UT_T1_SPIMODE
974
975 UT_003_03:
976   <<: *unit_test_template
977   tags:
978     - ESP32_IDF
979     - UT_T1_SPIMODE
980
981 UT_004_01:
982   <<: *unit_test_template
983   tags:
984     - ESP32_IDF
985     - UT_T1_1
986     - psram
987
988 UT_004_02:
989   <<: *unit_test_template
990   tags:
991     - ESP32_IDF
992     - UT_T1_1
993     - psram
994
995 UT_004_03:
996   <<: *unit_test_template
997   tags:
998     - ESP32_IDF
999     - UT_T1_1
1000     - psram
1001
1002 UT_004_04:
1003   <<: *unit_test_template
1004   tags:
1005     - ESP32_IDF
1006     - UT_T1_1
1007     - psram
1008
1009 UT_004_05:
1010   <<: *unit_test_template
1011   tags:
1012     - ESP32_IDF
1013     - UT_T1_1
1014     - psram
1015
1016 UT_004_06:
1017   <<: *unit_test_template
1018   tags:
1019     - ESP32_IDF
1020     - UT_T1_1
1021     - psram
1022
1023 UT_004_07:
1024   <<: *unit_test_template
1025   tags:
1026     - ESP32_IDF
1027     - UT_T1_1
1028     - psram
1029
1030 UT_004_08:
1031   <<: *unit_test_template
1032   tags:
1033     - ESP32_IDF
1034     - UT_T1_1
1035     - psram
1036
1037 UT_004_09:
1038   <<: *unit_test_template
1039   tags:
1040     - ESP32_IDF
1041     - UT_T1_1
1042     - psram
1043
1044 UT_004_10:
1045   <<: *unit_test_template
1046   tags:
1047     - ESP32_IDF
1048     - UT_T1_1
1049     - psram
1050     
1051 UT_004_11:
1052   <<: *unit_test_template
1053   tags:
1054     - ESP32_IDF
1055     - UT_T1_1
1056     - psram
1057     
1058 UT_005_01:
1059   <<: *unit_test_template
1060   tags:
1061     - ESP32_IDF
1062     - UT_T1_SDMODE
1063     - psram
1064
1065 UT_005_02:
1066   <<: *unit_test_template
1067   tags:
1068     - ESP32_IDF
1069     - UT_T1_SPIMODE
1070     - psram
1071
1072 UT_006_01:
1073   <<: *unit_test_template
1074   tags:
1075     - ESP32_IDF
1076     - UT_T1_GPIO
1077
1078 UT_006_02:
1079   <<: *unit_test_template
1080   tags:
1081     - ESP32_IDF
1082     - UT_T1_GPIO
1083
1084 UT_006_03:
1085   <<: *unit_test_template
1086   tags:
1087     - ESP32_IDF
1088     - UT_T1_GPIO
1089
1090 UT_006_04:
1091   <<: *unit_test_template
1092   tags:
1093     - ESP32_IDF
1094     - UT_T1_GPIO
1095     - psram
1096
1097 UT_007_01:
1098   <<: *unit_test_template
1099   tags:
1100     - ESP32_IDF
1101     - UT_T1_PCNT
1102
1103 UT_007_02:
1104   <<: *unit_test_template
1105   tags:
1106     - ESP32_IDF
1107     - UT_T1_PCNT
1108
1109 UT_007_03:
1110   <<: *unit_test_template
1111   tags:
1112     - ESP32_IDF
1113     - UT_T1_PCNT
1114
1115 UT_007_04:
1116   <<: *unit_test_template
1117   tags:
1118     - ESP32_IDF
1119     - UT_T1_PCNT
1120     - psram
1121
1122 UT_008_01:
1123   <<: *unit_test_template
1124   tags:
1125     - ESP32_IDF
1126     - UT_T1_LEDC
1127
1128 UT_008_02:
1129   <<: *unit_test_template
1130   tags:
1131     - ESP32_IDF
1132     - UT_T1_LEDC
1133
1134 UT_008_03:
1135   <<: *unit_test_template
1136   tags:
1137     - ESP32_IDF
1138     - UT_T1_LEDC
1139
1140 UT_008_04:
1141   <<: *unit_test_template
1142   tags:
1143     - ESP32_IDF
1144     - UT_T1_LEDC
1145     - psram
1146
1147 UT_010_01:
1148   <<: *unit_test_template
1149   tags:
1150     - ESP32_IDF
1151     - UT_T1_RMT
1152
1153 UT_010_02:
1154   <<: *unit_test_template
1155   tags:
1156     - ESP32_IDF
1157     - UT_T1_RMT
1158
1159 UT_010_03:
1160   <<: *unit_test_template
1161   tags:
1162     - ESP32_IDF
1163     - UT_T1_RMT
1164
1165 UT_010_04:
1166   <<: *unit_test_template
1167   tags:
1168     - ESP32_IDF
1169     - UT_T1_RMT
1170     - psram
1171
1172 UT_601_01:
1173   <<: *unit_test_template
1174   tags:
1175     - ESP32_IDF
1176     - UT_T1_1
1177
1178 IT_001_01:
1179   <<: *test_template
1180   tags:
1181     - ESP32_IDF
1182     - SSC_T1_1
1183
1184 IT_001_02:
1185   <<: *test_template
1186   tags:
1187     - ESP32_IDF
1188     - SSC_T1_1
1189
1190 IT_001_03:
1191   <<: *test_template
1192   tags:
1193     - ESP32_IDF
1194     - SSC_T1_1
1195
1196 IT_001_04:
1197   <<: *test_template
1198   tags:
1199     - ESP32_IDF
1200     - SSC_T1_1
1201
1202 IT_001_05:
1203   <<: *test_template
1204   tags:
1205     - ESP32_IDF
1206     - SSC_T1_1
1207
1208 IT_001_06:
1209   <<: *test_template
1210   tags:
1211     - ESP32_IDF
1212     - SSC_T1_1
1213
1214 IT_001_07:
1215   <<: *test_template
1216   tags:
1217     - ESP32_IDF
1218     - SSC_T1_1
1219
1220 IT_001_08:
1221   <<: *test_template
1222   tags:
1223     - ESP32_IDF
1224     - SSC_T1_1
1225
1226 IT_001_09:
1227   <<: *test_template
1228   tags:
1229     - ESP32_IDF
1230     - SSC_T1_1
1231
1232 IT_002_01:
1233   <<: *test_template
1234   tags:
1235     - ESP32_IDF
1236     - SSC_T1_2
1237
1238 IT_003_01:
1239   <<: *test_template
1240   tags:
1241     - ESP32_IDF
1242     - SSC_T2_1
1243
1244 IT_003_02:
1245   <<: *test_template
1246   tags:
1247     - ESP32_IDF
1248     - SSC_T2_1
1249
1250 IT_003_03:
1251   <<: *test_template
1252   tags:
1253     - ESP32_IDF
1254     - SSC_T2_1
1255
1256 IT_003_04:
1257   <<: *test_template
1258   tags:
1259     - ESP32_IDF
1260     - SSC_T2_1
1261
1262 IT_003_05:
1263   <<: *test_template
1264   tags:
1265     - ESP32_IDF
1266     - SSC_T2_1
1267
1268 IT_003_06:
1269   <<: *test_template
1270   tags:
1271     - ESP32_IDF
1272     - SSC_T2_1
1273
1274 IT_003_07:
1275   <<: *test_template
1276   tags:
1277     - ESP32_IDF
1278     - SSC_T2_1
1279
1280 IT_003_08:
1281   <<: *test_template
1282   tags:
1283     - ESP32_IDF
1284     - SSC_T2_1
1285
1286 IT_003_09:
1287   <<: *test_template
1288   tags:
1289     - ESP32_IDF
1290     - SSC_T2_1
1291
1292 IT_003_10:
1293   <<: *test_template
1294   tags:
1295     - ESP32_IDF
1296     - SSC_T2_1
1297
1298 IT_003_11:
1299   <<: *test_template
1300   tags:
1301     - ESP32_IDF
1302     - SSC_T2_1
1303
1304 IT_003_12:
1305   <<: *test_template
1306   tags:
1307     - ESP32_IDF
1308     - SSC_T2_1
1309
1310 IT_003_13:
1311   <<: *test_template
1312   tags:
1313     - ESP32_IDF
1314     - SSC_T2_1
1315
1316 IT_003_14:
1317   <<: *test_template
1318   tags:
1319     - ESP32_IDF
1320     - SSC_T2_1
1321
1322 IT_004_01:
1323   <<: *test_template
1324   tags:
1325     - ESP32_IDF
1326     - SSC_T1_APC
1327
1328 IT_005_01:
1329   <<: *test_template
1330   tags:
1331     - ESP32_IDF
1332     - SSC_T1_WEP
1333
1334 IT_009_01:
1335   <<: *test_template
1336   tags:
1337     - ESP32_IDF
1338     - SSC_T1_3
1339
1340 IT_010_01:
1341   <<: *test_template
1342   tags:
1343     - ESP32_IDF
1344     - SSC_T5_1
1345
1346 IT_011_01:
1347   <<: *test_template
1348   tags:
1349     - ESP32_IDF
1350     - SSC_T50_1
1351
1352 IT_501_01:
1353   <<: *test_template
1354   tags:
1355     - ESP32_IDF
1356     - SSC_T1_1
1357     - stress_test
1358
1359 IT_501_02:
1360   <<: *test_template
1361   tags:
1362     - ESP32_IDF
1363     - SSC_T1_1
1364     - stress_test
1365
1366 IT_501_03:
1367   <<: *test_template
1368   tags:
1369     - ESP32_IDF
1370     - SSC_T1_1
1371     - stress_test
1372
1373 IT_502_01:
1374   <<: *test_template
1375   tags:
1376     - ESP32_IDF
1377     - SSC_T2_1
1378     - stress_test
1379
1380 IT_502_02:
1381   <<: *test_template
1382   tags:
1383     - ESP32_IDF
1384     - SSC_T2_1
1385     - stress_test
1386
1387 IT_503_01:
1388   <<: *test_template
1389   tags:
1390     - ESP32_IDF
1391     - SSC_T5_1
1392     - stress_test
1393
1394 IT_503_02:
1395   <<: *test_template
1396   tags:
1397     - ESP32_IDF
1398     - SSC_T5_1
1399     - stress_test
1400
1401 IT_503_03:
1402   <<: *test_template
1403   tags:
1404     - ESP32_IDF
1405     - SSC_T5_1
1406     - stress_test