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