]> granicus.if.org Git - esp-idf/blob - .gitlab-ci.yml
Merge branch 'ci/add_check_stage' into 'master'
[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_idf_size:
402   <<: *host_test_template
403   artifacts:
404     when: on_failure
405     paths:
406       - tools/test_idf_size/output
407       - tools/test_idf_size/.coverage
408     expire_in: 1 week
409   script:
410     - cd ${IDF_PATH}/tools/test_idf_size
411     - source /opt/pyenv/activate
412     - pyenv global 2.7.15
413     - ./test.sh
414     - pyenv global 3.4.8
415     - ./test.sh
416     - pyenv global system
417
418 test_esp_err_to_name_on_host:
419   <<: *host_test_template
420   artifacts:
421     when: on_failure
422     paths:
423       - components/esp32/esp_err_to_name.c
424     expire_in: 1 week
425   script:
426     - cd tools/
427     - source /opt/pyenv/activate
428     - pyenv global 2.7.15
429     - ./gen_esp_err_to_name.py
430     - 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)
431     - pyenv global 3.4.8
432     - ./gen_esp_err_to_name.py
433     - git diff --exit-code -- ../components/esp32/esp_err_to_name.c || (echo 'Differences found between running under Python 2 and 3.'; exit 1)
434     - pyenv global system
435
436 push_to_github:
437   stage: deploy
438   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
439   tags:
440     - deploy
441   only:
442     - master
443     - /^release\/v/
444     - /^v\d+\.\d+(\.\d+)?($|-)/
445   when: on_success
446   dependencies: []
447   before_script: *do_nothing_before
448   script:
449     - mkdir -p ~/.ssh
450     - chmod 700 ~/.ssh
451     - echo -n $GH_PUSH_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 github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
455     - git remote remove github &>/dev/null || true
456     - git remote add github git@github.com:espressif/esp-idf.git
457     # Need separate push commands for tag builds and for branch builds
458     - "[ -n \"${CI_COMMIT_TAG}\" ] && git push github ${CI_COMMIT_TAG}"
459     - "[ -z \"${CI_COMMIT_TAG}\" ] && git push github ${CI_COMMIT_SHA}:refs/heads/${CI_COMMIT_REF_NAME}"
460
461 deploy_docs:
462   stage: host_test
463   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
464   tags:
465     - deploy
466   only:
467    - master
468    - /^release\/v/
469    - /^v\d+\.\d+(\.\d+)?($|-)/
470    - triggers
471   dependencies:
472     - build_docs
473   before_script: *do_nothing_before
474   script:
475     - mkdir -p ~/.ssh
476     - chmod 700 ~/.ssh
477     - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
478     - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
479     - chmod 600 ~/.ssh/id_rsa
480     - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
481     - export GIT_VER=$(git describe --always)
482     - cd docs/en/_build/
483     - mv html $GIT_VER
484     - tar czvf $GIT_VER.tar.gz $GIT_VER
485     - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/en
486     - ssh $DOCS_SERVER -x "cd $DOCS_PATH/en && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
487     - cd ../../zh_CN/_build/
488     - mv html $GIT_VER
489     - tar czvf $GIT_VER.tar.gz $GIT_VER
490     - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/zh_CN
491     - ssh $DOCS_SERVER -x "cd $DOCS_PATH/zh_CN && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
492     # add link to preview doc
493     - echo "[document preview][en] $CI_DOCKER_REGISTRY/docs/esp-idf/en/${GIT_VER}/index.html"
494     - echo "[document preview][zh_CN] $CI_DOCKER_REGISTRY/docs/esp-idf/zh_CN/${GIT_VER}/index.html"
495
496 check_doc_links:
497   stage: host_test
498   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
499   tags:
500     - check_doc_links
501   only:
502     # can only be triggered
503     - triggers
504   artifacts:
505     paths:
506       - docs/_build/linkcheck
507     expire_in: 1 mos
508   script:
509     # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
510     - test "$CHECK_LINKS" = "Yes" || exit 0
511     # can only run on master branch (otherwise the commit is not on Github yet)
512     - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
513     - cd docs
514     - make linkcheck
515
516 check_line_endings:
517   stage: check
518   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
519   tags:
520     - build
521   dependencies: []
522   before_script: *do_nothing_before_no_filter
523   script:
524     - tools/ci/check-line-endings.sh ${IDF_PATH}
525
526 check_commit_msg:
527   stage: check
528   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
529   tags:
530     - build
531   dependencies: []
532   before_script: *do_nothing_before_no_filter
533   script:
534     - git status
535     - git log -n10 --oneline
536     # commit start with "WIP: " need to be squashed before merge
537     - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
538
539 check_permissions:
540   stage: check
541   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
542   tags:
543     - build
544   dependencies: []
545   before_script: *do_nothing_before_no_filter
546   script:
547     - tools/ci/check-executable.sh
548
549 check_submodule_sync:
550   stage: check
551   image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
552   tags:
553     - build
554   dependencies: []
555   variables:
556     GIT_STRATEGY: clone
557   before_script: *do_nothing_before_no_filter
558   script:
559     # check if all submodules are correctly synced to public repostory
560     - git submodule update --init --recursive
561
562 assign_test:
563   tags:
564     - assign_test
565   image: $CI_DOCKER_REGISTRY/ubuntu-test-env
566   stage: assign_test
567   # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
568   # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
569   dependencies:
570     - build_ssc_00
571     - build_ssc_01
572     - build_ssc_02
573     - build_esp_idf_tests
574   variables:
575     TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
576     EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
577   artifacts:
578     paths:
579       - components/idf_test/*/CIConfigs
580       - components/idf_test/*/TC.sqlite
581       - $EXAMPLE_CONFIG_OUTPUT_PATH
582     expire_in: 1 mos
583   before_script: *add_gitlab_key_before
584   script:
585     # assign example tests
586     - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
587     # assign unit test cases
588     - 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
589     # clone test script to assign tests
590     - git clone $TEST_SCRIPT_REPOSITORY
591     - cd auto_test_script
592     - python $CHECKOUT_REF_SCRIPT auto_test_script
593     # assgin integration test cases
594     - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
595
596 .example_test_template: &example_test_template
597   stage: integration_test
598   when: on_success
599   only:
600     - master
601     - /^release\/v/
602     - /^v\d+\.\d+(\.\d+)?($|-)/
603     - triggers
604     - schedules
605   dependencies:
606     - assign_test
607     - build_examples_00
608     - build_examples_01
609     - build_examples_02
610     - build_examples_03
611     - build_examples_04
612     - build_examples_05
613     - build_examples_06
614     - build_examples_07
615   artifacts:
616     when: always
617     paths:
618       - $LOG_PATH
619     expire_in: 1 mos
620   variables:
621     TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
622     TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
623     CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
624     LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
625     ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
626   script:
627     # first test if config file exists, if not exist, exit 0
628     - test -e $CONFIG_FILE || exit 0
629     # clone test env configs
630     - git clone $TEST_ENV_CONFIG_REPOSITORY
631     - cd ci-test-runner-configs
632     - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
633     - cd $TEST_FW_PATH
634     # run test
635     - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
636
637 .unit_test_template: &unit_test_template
638   <<: *example_test_template
639   stage: unit_test
640   dependencies:
641     - assign_test
642     - build_esp_idf_tests
643   variables:
644     TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
645     TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
646     CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
647     LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
648     ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
649
650 .test_template: &test_template
651   stage: integration_test
652   when: on_success
653   only:
654     - master
655     - /^release\/v/
656     - /^v\d+\.\d+(\.\d+)?($|-)/
657     - triggers
658     - schedules
659   dependencies:
660     - assign_test
661     - build_ssc_00
662     - build_ssc_01
663     - build_ssc_02
664   artifacts:
665     when: always
666     paths:
667       - $LOG_PATH
668     expire_in: 1 mos
669   variables:
670     LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
671     LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
672     TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
673     MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
674     CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
675   before_script: *add_gitlab_key_before
676   script:
677     # first test if config file exists, if not exist, exit 0
678     - test -e $CONFIG_FILE || exit 0
679     # clone local test env configs
680     - git clone $TEST_ENV_CONFIG_REPOSITORY
681     - cd ci-test-runner-configs
682     - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
683     # clone test bench
684     - git clone $TEST_SCRIPT_REPOSITORY
685     - cd auto_test_script
686     - python $CHECKOUT_REF_SCRIPT auto_test_script
687     # run test
688     - 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
689
690 nvs_compatible_test:
691   <<: *test_template
692   artifacts:
693     when: always
694     paths:
695       - $LOG_PATH
696       - nvs_wifi.bin
697     expire_in: 1 mos
698   tags:
699     - ESP32_IDF
700     - NVS_Compatible
701   script:
702     # clone local test env configs
703     - git clone $TEST_ENV_CONFIG_REPOSITORY
704     - cd ci-test-runner-configs
705     - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
706     # clone test bench
707     - git clone $TEST_SCRIPT_REPOSITORY
708     - cd auto_test_script
709     - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
710     # prepare nvs bins
711     - ./Tools/prepare_nvs_bin.sh
712     # run test
713     - 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
714
715 example_test_001_01:
716   <<: *example_test_template
717   tags:
718     - ESP32
719     - Example_WIFI
720
721 example_test_002_01:
722   <<: *example_test_template
723   tags:
724     - ESP32
725     - Example_ShieldBox
726
727 example_test_003_01:
728   <<: *example_test_template
729   tags:
730     - ESP32
731     - Example_SDIO
732
733 example_test_004_01:
734   <<: *example_test_template
735   tags:
736     - ESP32
737     - Example_CAN
738
739 UT_001_01:
740   <<: *unit_test_template
741   tags:
742     - ESP32_IDF
743     - UT_T1_1
744
745 UT_001_02:
746   <<: *unit_test_template
747   tags:
748     - ESP32_IDF
749     - UT_T1_1
750
751 UT_001_03:
752   <<: *unit_test_template
753   tags:
754     - ESP32_IDF
755     - UT_T1_1
756
757 UT_001_04:
758   <<: *unit_test_template
759   tags:
760     - ESP32_IDF
761     - UT_T1_1
762
763 UT_001_05:
764   <<: *unit_test_template
765   tags:
766     - ESP32_IDF
767     - UT_T1_1
768
769 UT_001_06:
770   <<: *unit_test_template
771   tags:
772     - ESP32_IDF
773     - UT_T1_1
774
775 UT_001_07:
776   <<: *unit_test_template
777   tags:
778     - ESP32_IDF
779     - UT_T1_1
780
781 UT_001_08:
782   <<: *unit_test_template
783   tags:
784     - ESP32_IDF
785     - UT_T1_1
786
787 UT_001_09:
788   <<: *unit_test_template
789   tags:
790     - ESP32_IDF
791     - UT_T1_1
792
793 UT_001_10:
794   <<: *unit_test_template
795   tags:
796     - ESP32_IDF
797     - UT_T1_1
798
799 UT_001_11:
800   <<: *unit_test_template
801   tags:
802     - ESP32_IDF
803     - UT_T1_1
804
805 UT_001_12:
806   <<: *unit_test_template
807   tags:
808     - ESP32_IDF
809     - UT_T1_1
810
811 UT_001_13:
812   <<: *unit_test_template
813   tags:
814     - ESP32_IDF
815     - UT_T1_1
816
817 UT_001_14:
818   <<: *unit_test_template
819   tags:
820     - ESP32_IDF
821     - UT_T1_1
822
823 UT_001_15:
824   <<: *unit_test_template
825   tags:
826     - ESP32_IDF
827     - UT_T1_1
828
829 UT_001_16:
830   <<: *unit_test_template
831   tags:
832     - ESP32_IDF
833     - UT_T1_1
834
835 UT_001_17:
836   <<: *unit_test_template
837   tags:
838     - ESP32_IDF
839     - UT_T1_1
840
841 UT_001_18:
842   <<: *unit_test_template
843   tags:
844     - ESP32_IDF
845     - UT_T1_1
846
847 UT_001_19:
848   <<: *unit_test_template
849   tags:
850     - ESP32_IDF
851     - UT_T1_1
852
853 UT_001_20:
854   <<: *unit_test_template
855   tags:
856     - ESP32_IDF
857     - UT_T1_1
858
859 UT_001_21:
860   <<: *unit_test_template
861   tags:
862     - ESP32_IDF
863     - UT_T1_1
864
865 UT_001_22:
866   <<: *unit_test_template
867   tags:
868     - ESP32_IDF
869     - UT_T1_1
870
871 UT_001_23:
872   <<: *unit_test_template
873   tags:
874     - ESP32_IDF
875     - UT_T1_1
876
877 UT_001_24:
878   <<: *unit_test_template
879   tags:
880     - ESP32_IDF
881     - UT_T1_1
882
883 UT_001_25:
884   <<: *unit_test_template
885   tags:
886     - ESP32_IDF
887     - UT_T1_1
888     
889 UT_001_26:
890   <<: *unit_test_template
891   tags:
892     - ESP32_IDF
893     - UT_T1_1
894
895 UT_001_27:
896   <<: *unit_test_template
897   tags:
898     - ESP32_IDF
899     - UT_T1_1
900
901 UT_001_28:
902   <<: *unit_test_template
903   tags:
904     - ESP32_IDF
905     - UT_T1_1
906
907 UT_001_29:
908   <<: *unit_test_template
909   tags:
910     - ESP32_IDF
911     - UT_T1_1
912
913 UT_001_30:
914   <<: *unit_test_template
915   tags:
916     - ESP32_IDF
917     - UT_T1_1
918
919 UT_001_31:
920   <<: *unit_test_template
921   tags:
922     - ESP32_IDF
923     - UT_T1_1
924     
925 UT_001_32:
926   <<: *unit_test_template
927   tags:
928     - ESP32_IDF
929     - UT_T1_1
930
931 UT_001_33:
932   <<: *unit_test_template
933   tags:
934     - ESP32_IDF
935     - UT_T1_1
936     
937 UT_001_34:
938   <<: *unit_test_template
939   tags:
940     - ESP32_IDF
941     - UT_T1_1
942
943 UT_001_35:
944   <<: *unit_test_template
945   tags:
946     - ESP32_IDF
947     - UT_T1_1
948
949 UT_001_36:
950   <<: *unit_test_template
951   tags:
952     - ESP32_IDF
953     - UT_T1_1
954
955 UT_002_01:
956   <<: *unit_test_template
957   tags:
958     - ESP32_IDF
959     - UT_T1_SDMODE
960
961 UT_002_02:
962   <<: *unit_test_template
963   tags:
964     - ESP32_IDF
965     - UT_T1_SDMODE
966
967 UT_002_03:
968   <<: *unit_test_template
969   tags:
970     - ESP32_IDF
971     - UT_T1_SDMODE
972
973 UT_003_01:
974   <<: *unit_test_template
975   tags:
976     - ESP32_IDF
977     - UT_T1_SPIMODE
978
979 UT_003_02:
980   <<: *unit_test_template
981   tags:
982     - ESP32_IDF
983     - UT_T1_SPIMODE
984
985 UT_003_03:
986   <<: *unit_test_template
987   tags:
988     - ESP32_IDF
989     - UT_T1_SPIMODE
990
991 UT_004_01:
992   <<: *unit_test_template
993   tags:
994     - ESP32_IDF
995     - UT_T1_1
996     - psram
997
998 UT_004_02:
999   <<: *unit_test_template
1000   tags:
1001     - ESP32_IDF
1002     - UT_T1_1
1003     - psram
1004
1005 UT_004_03:
1006   <<: *unit_test_template
1007   tags:
1008     - ESP32_IDF
1009     - UT_T1_1
1010     - psram
1011
1012 UT_004_04:
1013   <<: *unit_test_template
1014   tags:
1015     - ESP32_IDF
1016     - UT_T1_1
1017     - psram
1018
1019 UT_004_05:
1020   <<: *unit_test_template
1021   tags:
1022     - ESP32_IDF
1023     - UT_T1_1
1024     - psram
1025
1026 UT_004_06:
1027   <<: *unit_test_template
1028   tags:
1029     - ESP32_IDF
1030     - UT_T1_1
1031     - psram
1032
1033 UT_004_07:
1034   <<: *unit_test_template
1035   tags:
1036     - ESP32_IDF
1037     - UT_T1_1
1038     - psram
1039
1040 UT_004_08:
1041   <<: *unit_test_template
1042   tags:
1043     - ESP32_IDF
1044     - UT_T1_1
1045     - psram
1046
1047 UT_004_09:
1048   <<: *unit_test_template
1049   tags:
1050     - ESP32_IDF
1051     - UT_T1_1
1052     - psram
1053
1054 UT_004_10:
1055   <<: *unit_test_template
1056   tags:
1057     - ESP32_IDF
1058     - UT_T1_1
1059     - psram
1060     
1061 UT_004_11:
1062   <<: *unit_test_template
1063   tags:
1064     - ESP32_IDF
1065     - UT_T1_1
1066     - psram
1067     
1068 UT_005_01:
1069   <<: *unit_test_template
1070   tags:
1071     - ESP32_IDF
1072     - UT_T1_SDMODE
1073     - psram
1074
1075 UT_005_02:
1076   <<: *unit_test_template
1077   tags:
1078     - ESP32_IDF
1079     - UT_T1_SPIMODE
1080     - psram
1081
1082 UT_006_01:
1083   <<: *unit_test_template
1084   tags:
1085     - ESP32_IDF
1086     - UT_T1_GPIO
1087
1088 UT_006_02:
1089   <<: *unit_test_template
1090   tags:
1091     - ESP32_IDF
1092     - UT_T1_GPIO
1093
1094 UT_006_03:
1095   <<: *unit_test_template
1096   tags:
1097     - ESP32_IDF
1098     - UT_T1_GPIO
1099
1100 UT_006_04:
1101   <<: *unit_test_template
1102   tags:
1103     - ESP32_IDF
1104     - UT_T1_GPIO
1105     - psram
1106
1107 UT_007_01:
1108   <<: *unit_test_template
1109   tags:
1110     - ESP32_IDF
1111     - UT_T1_PCNT
1112
1113 UT_007_02:
1114   <<: *unit_test_template
1115   tags:
1116     - ESP32_IDF
1117     - UT_T1_PCNT
1118
1119 UT_007_03:
1120   <<: *unit_test_template
1121   tags:
1122     - ESP32_IDF
1123     - UT_T1_PCNT
1124
1125 UT_007_04:
1126   <<: *unit_test_template
1127   tags:
1128     - ESP32_IDF
1129     - UT_T1_PCNT
1130     - psram
1131
1132 UT_008_01:
1133   <<: *unit_test_template
1134   tags:
1135     - ESP32_IDF
1136     - UT_T1_LEDC
1137
1138 UT_008_02:
1139   <<: *unit_test_template
1140   tags:
1141     - ESP32_IDF
1142     - UT_T1_LEDC
1143
1144 UT_008_03:
1145   <<: *unit_test_template
1146   tags:
1147     - ESP32_IDF
1148     - UT_T1_LEDC
1149
1150 UT_008_04:
1151   <<: *unit_test_template
1152   tags:
1153     - ESP32_IDF
1154     - UT_T1_LEDC
1155     - psram
1156
1157 UT_010_01:
1158   <<: *unit_test_template
1159   tags:
1160     - ESP32_IDF
1161     - UT_T1_RMT
1162
1163 UT_010_02:
1164   <<: *unit_test_template
1165   tags:
1166     - ESP32_IDF
1167     - UT_T1_RMT
1168
1169 UT_010_03:
1170   <<: *unit_test_template
1171   tags:
1172     - ESP32_IDF
1173     - UT_T1_RMT
1174
1175 UT_010_04:
1176   <<: *unit_test_template
1177   tags:
1178     - ESP32_IDF
1179     - UT_T1_RMT
1180     - psram
1181
1182 UT_011_01:
1183   <<: *unit_test_template
1184   tags:
1185     - ESP32_IDF
1186     - EMMC
1187
1188 UT_011_02:
1189   <<: *unit_test_template
1190   tags:
1191     - ESP32_IDF
1192     - EMMC
1193
1194 UT_011_03:
1195   <<: *unit_test_template
1196   tags:
1197     - ESP32_IDF
1198     - EMMC
1199
1200 UT_601_01:
1201   <<: *unit_test_template
1202   tags:
1203     - ESP32_IDF
1204     - UT_T1_1
1205
1206 IT_001_01:
1207   <<: *test_template
1208   tags:
1209     - ESP32_IDF
1210     - SSC_T1_1
1211
1212 IT_001_02:
1213   <<: *test_template
1214   tags:
1215     - ESP32_IDF
1216     - SSC_T1_1
1217
1218 IT_001_03:
1219   <<: *test_template
1220   tags:
1221     - ESP32_IDF
1222     - SSC_T1_1
1223
1224 IT_001_04:
1225   <<: *test_template
1226   tags:
1227     - ESP32_IDF
1228     - SSC_T1_1
1229
1230 IT_001_05:
1231   <<: *test_template
1232   tags:
1233     - ESP32_IDF
1234     - SSC_T1_1
1235
1236 IT_001_06:
1237   <<: *test_template
1238   tags:
1239     - ESP32_IDF
1240     - SSC_T1_1
1241
1242 IT_001_07:
1243   <<: *test_template
1244   tags:
1245     - ESP32_IDF
1246     - SSC_T1_1
1247
1248 IT_001_08:
1249   <<: *test_template
1250   tags:
1251     - ESP32_IDF
1252     - SSC_T1_1
1253
1254 IT_001_09:
1255   <<: *test_template
1256   tags:
1257     - ESP32_IDF
1258     - SSC_T1_1
1259
1260 IT_002_01:
1261   <<: *test_template
1262   tags:
1263     - ESP32_IDF
1264     - SSC_T1_2
1265
1266 IT_003_01:
1267   <<: *test_template
1268   tags:
1269     - ESP32_IDF
1270     - SSC_T2_1
1271
1272 IT_003_02:
1273   <<: *test_template
1274   tags:
1275     - ESP32_IDF
1276     - SSC_T2_1
1277
1278 IT_003_03:
1279   <<: *test_template
1280   tags:
1281     - ESP32_IDF
1282     - SSC_T2_1
1283
1284 IT_003_04:
1285   <<: *test_template
1286   tags:
1287     - ESP32_IDF
1288     - SSC_T2_1
1289
1290 IT_003_05:
1291   <<: *test_template
1292   tags:
1293     - ESP32_IDF
1294     - SSC_T2_1
1295
1296 IT_003_06:
1297   <<: *test_template
1298   tags:
1299     - ESP32_IDF
1300     - SSC_T2_1
1301
1302 IT_003_07:
1303   <<: *test_template
1304   tags:
1305     - ESP32_IDF
1306     - SSC_T2_1
1307
1308 IT_003_08:
1309   <<: *test_template
1310   tags:
1311     - ESP32_IDF
1312     - SSC_T2_1
1313
1314 IT_003_09:
1315   <<: *test_template
1316   tags:
1317     - ESP32_IDF
1318     - SSC_T2_1
1319
1320 IT_003_10:
1321   <<: *test_template
1322   tags:
1323     - ESP32_IDF
1324     - SSC_T2_1
1325
1326 IT_003_11:
1327   <<: *test_template
1328   tags:
1329     - ESP32_IDF
1330     - SSC_T2_1
1331
1332 IT_003_12:
1333   <<: *test_template
1334   tags:
1335     - ESP32_IDF
1336     - SSC_T2_1
1337
1338 IT_003_13:
1339   <<: *test_template
1340   tags:
1341     - ESP32_IDF
1342     - SSC_T2_1
1343
1344 IT_003_14:
1345   <<: *test_template
1346   tags:
1347     - ESP32_IDF
1348     - SSC_T2_1
1349
1350 IT_004_01:
1351   <<: *test_template
1352   tags:
1353     - ESP32_IDF
1354     - SSC_T1_APC
1355
1356 IT_005_01:
1357   <<: *test_template
1358   tags:
1359     - ESP32_IDF
1360     - SSC_T1_WEP
1361
1362 IT_009_01:
1363   <<: *test_template
1364   tags:
1365     - ESP32_IDF
1366     - SSC_T1_3
1367
1368 IT_010_01:
1369   <<: *test_template
1370   tags:
1371     - ESP32_IDF
1372     - SSC_T5_1
1373
1374 IT_011_01:
1375   <<: *test_template
1376   tags:
1377     - ESP32_IDF
1378     - SSC_T50_1
1379
1380 IT_501_01:
1381   <<: *test_template
1382   tags:
1383     - ESP32_IDF
1384     - SSC_T1_1
1385     - stress_test
1386
1387 IT_501_02:
1388   <<: *test_template
1389   tags:
1390     - ESP32_IDF
1391     - SSC_T1_1
1392     - stress_test
1393
1394 IT_501_03:
1395   <<: *test_template
1396   tags:
1397     - ESP32_IDF
1398     - SSC_T1_1
1399     - stress_test
1400
1401 IT_502_01:
1402   <<: *test_template
1403   tags:
1404     - ESP32_IDF
1405     - SSC_T2_1
1406     - stress_test
1407
1408 IT_502_02:
1409   <<: *test_template
1410   tags:
1411     - ESP32_IDF
1412     - SSC_T2_1
1413     - stress_test
1414
1415 IT_503_01:
1416   <<: *test_template
1417   tags:
1418     - ESP32_IDF
1419     - SSC_T5_1
1420     - stress_test
1421
1422 IT_503_02:
1423   <<: *test_template
1424   tags:
1425     - ESP32_IDF
1426     - SSC_T5_1
1427     - stress_test
1428
1429 IT_503_03:
1430   <<: *test_template
1431   tags:
1432     - ESP32_IDF
1433     - SSC_T5_1
1434     - stress_test