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