12 # Common parameters for the 'make' during CI tests
13 MAKEFLAGS: "-j5 --no-keep-going"
15 # GitLab-CI environment
17 # more attempts for more robust
18 GET_SOURCES_ATTEMPTS: "10"
19 ARTIFACT_DOWNLOAD_ATTEMPTS: "10"
21 # We use get_sources.sh script to fetch the submodules and/or re-fetch the repo
22 # if it was corrupted (if submodule update fails this can happen)
24 GIT_SUBMODULE_STRATEGY: none
28 IDF_PATH: "$CI_PROJECT_DIR"
31 APPLY_BOT_FILTER_SCRIPT: "$CI_PROJECT_DIR/tools/ci/apply_bot_filter.py"
32 CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
34 # When 'fetch' strategy is used, Gitlab removes untracked files before checking out
35 # new revision. However if the new revision doesn't include some of the submodules
36 # which were present in the old revision, such submodule directories would not be
37 # removed by the checkout. This extra step ensures that these stale submodules
39 .git_clean_stale_submodules: &git_clean_stale_submodules >
40 find . -name '.git' -not -path './.git' -printf '%P\n'
43 grep -q {} .gitmodules
44 || (echo "Removing {}, has .git directory but not in .gitmodules file"
47 # before each job, we need to check if this job is filtered by bot stage/job filter
48 .apply_bot_filter: &apply_bot_filter
49 python $APPLY_BOT_FILTER_SCRIPT || exit 0
52 - *git_clean_stale_submodules
53 # apply bot filter in before script
58 - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
59 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
60 - chmod 600 ~/.ssh/id_rsa
61 - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
63 # Set IS_PRIVATE or IS_PUBLIC depending on if our branch is public or not
65 # (the same regular expressions are used to set these are used in 'only:' sections below
66 - source tools/ci/configure_ci_environment.sh
68 # fetch the submodules (& if necessary re-fetch repo) from gitlab
69 - time ./tools/ci/get-full-sources.sh
72 before_script: &do_nothing_before
73 - *git_clean_stale_submodules
74 # apply bot filter in before script
76 - echo "Not setting up GitLab key, not fetching submodules"
77 - source tools/ci/configure_ci_environment.sh
79 .add_gitlab_key_before:
80 before_script: &add_gitlab_key_before
81 - *git_clean_stale_submodules
82 # apply bot filter in before script
84 - echo "Not fetching submodules"
85 - source tools/ci/configure_ci_environment.sh
89 - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
90 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
91 - chmod 600 ~/.ssh/id_rsa
92 - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
96 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
103 - git clone https://github.com/espressif/esp-idf-template.git
104 - cd esp-idf-template
105 # Try to use the same branch name for esp-idf-template that we're
106 # using on esp-idf. If it doesn't exist then just stick to the default
108 - python $CHECKOUT_REF_SCRIPT esp-idf-template
109 # Test debug build (default)
111 # Now test release build
113 - sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
115 # Check if there are any stray printf/ets_printf references in WiFi libs
116 - cd ../components/esp32/lib
117 - test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
118 - test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0
121 .build_template: &build_template
123 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
130 .build_ssc_template: &build_ssc_template
137 SSC_CONFIG_FOLDER: "$CI_PROJECT_DIR/SSC/configs/ESP32_IDF"
139 - git clone $SSC_REPOSITORY
141 - python $CHECKOUT_REF_SCRIPT SSC
142 - MAKEFLAGS= ./ci_build_ssc.sh "${CI_JOB_NAME}" "${IDF_PATH}/.gitlab-ci.yml"
144 # don't forget to add to dependency to test_template when adding new build_ssc jobs
146 <<: *build_ssc_template
149 <<: *build_ssc_template
152 <<: *build_ssc_template
154 # If you want to add new build ssc jobs, please add it into dependencies of `assign_test` and `.test_template`
160 - tools/unit-test-app/output
161 - components/idf_test/unit_test/TestCaseAll.yml
162 - components/idf_test/unit_test/CIConfigs/*.yml
165 - cd tools/unit-test-app
166 - MAKEFLAGS= make help # make sure kconfig tools are built in single process
167 - make ut-clean-all-configs
168 - export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
169 - export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
170 - make ut-build-all-configs
171 - python tools/UnitTestParser.py
173 .build_examples_template: &build_examples_template
179 - build_examples/*/*/*/build/*.bin
180 - build_examples/*/*/*/build/*.elf
181 - build_examples/*/*/*/build/*.map
182 - build_examples/*/*/*/build/download.config
183 - build_examples/*/*/*/build/bootloader/*.bin
188 LOG_PATH: "$CI_PROJECT_DIR/log_examples"
190 # it's not possible to build 100% out-of-tree and have the "artifacts"
191 # mechanism work, but this is the next best thing
192 - rm -rf build_examples
193 - mkdir build_examples
195 # build some of examples
196 - mkdir -p ${LOG_PATH}
197 - ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
200 <<: *build_examples_template
203 <<: *build_examples_template
206 <<: *build_examples_template
209 <<: *build_examples_template
212 <<: *build_examples_template
215 <<: *build_examples_template
218 <<: *build_examples_template
221 <<: *build_examples_template
223 # If you want to add new build example jobs, please add it into dependencies of `.example_test_template`
227 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
233 # English version of documentation
234 - docs/en/doxygen-warning-log.txt
235 - docs/en/sphinx-warning-log.txt
236 - docs/en/sphinx-warning-log-sanitized.txt
237 - docs/en/_build/html
238 # Chinese version of documentation
239 - docs/zh_CN/doxygen-warning-log.txt
240 - docs/zh_CN/sphinx-warning-log.txt
241 - docs/zh_CN/sphinx-warning-log-sanitized.txt
242 - docs/zh_CN/_build/html
246 - ./check_lang_folder_sync.sh
250 - ../check_doc_warnings.sh
254 - ../check_doc_warnings.sh
256 .host_test_template: &host_test_template
258 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
264 <<: *host_test_template
266 - cd components/nvs_flash/test_nvs_host
270 <<: *host_test_template
273 - components/nvs_flash/test_nvs_host/coverage_report
276 # This job takes a few hours to finish, so only run it on demand
278 BOT_NEEDS_TRIGGER_BY_NAME: 1
280 - cd components/nvs_flash/test_nvs_host
281 - make coverage_report
283 test_partition_table_on_host:
284 <<: *host_test_template
288 - cd components/partition_table/test_gen_esp32part_host
289 - ./gen_esp32part_tests.py
292 <<: *host_test_template
295 - components/wear_levelling/test_wl_host/coverage_report.zip
297 - cd components/wear_levelling/test_wl_host
301 <<: *host_test_template
303 - cd components/fatfs/test_fatfs_host/
306 .host_fuzzer_test_template: &host_fuzzer_test_template
308 image: $CI_DOCKER_REGISTRY/afl-fuzzer-test
315 - ${FUZZER_TEST_DIR}/out/crashes
316 - ${FUZZER_TEST_DIR}/fuzz_output.log
319 # can only be triggered
322 BOT_NEEDS_TRIGGER_BY_NAME: 1
324 - export AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 && export AFL_SKIP_CPUFREQ=1
325 - cd ${FUZZER_TEST_DIR}
326 # run AFL fuzzer for one hour
327 - ( ( make ${FUZZER_PARAMS} fuzz | tee fuzz_output.log | grep -v '\(Fuzzing test case\|Entering queue cycle\)' ) || pkill sleep ) &
328 - ( sleep 3600 || mkdir -p out/crashes/env_failed ) && pkill afl-fuz
329 # check no crashes found
330 - test -z "$(ls out/crashes/)" || exit 1
332 test_mdns_fuzzer_on_host:
333 <<: *host_fuzzer_test_template
335 FUZZER_TEST_DIR: components/mdns/test_afl_fuzz_host
337 test_lwip_dns_fuzzer_on_host:
338 <<: *host_fuzzer_test_template
340 FUZZER_TEST_DIR: components/lwip/test_afl_host
341 FUZZER_PARAMS: MODE=dns
343 test_lwip_dhcp_fuzzer_on_host:
344 <<: *host_fuzzer_test_template
346 FUZZER_TEST_DIR: components/lwip/test_afl_host
347 FUZZER_PARAMS: MODE=dhcp_client
349 test_lwip_dhcps_fuzzer_on_host:
350 <<: *host_fuzzer_test_template
352 FUZZER_TEST_DIR: components/lwip/test_afl_host
353 FUZZER_PARAMS: MODE=dhcp_server
356 <<: *host_test_template
358 - cd components/spiffs/test_spiffs_host/
361 test_multi_heap_on_host:
362 <<: *host_test_template
364 - cd components/heap/test_multi_heap_host
365 - ./test_all_configs.sh
368 <<: *host_test_template
370 - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
371 - rm -rf test_build_system
372 - mkdir test_build_system
373 - cd test_build_system
374 - ${IDF_PATH}/tools/ci/test_build_system.sh
377 <<: *host_test_template
381 - tools/test_idf_monitor/outputs/*
384 - cd ${IDF_PATH}/tools/test_idf_monitor
385 - source /opt/pyenv/activate
386 - pyenv global 2.7.15
387 - ./run_test_idf_monitor.py
389 - ./run_test_idf_monitor.py
390 - pyenv global system
392 test_esp_err_to_name_on_host:
393 <<: *host_test_template
397 - components/esp32/esp_err_to_name.c
401 - source /opt/pyenv/activate
402 - pyenv global 2.7.15
403 - ./gen_esp_err_to_name.py
404 - git diff --exit-code -- ../components/esp32/esp_err_to_name.c || (echo 'Differences found. Please run gen_esp_err_to_name.py and commit the changes.'; exit 1)
406 - ./gen_esp_err_to_name.py
407 - git diff --exit-code -- ../components/esp32/esp_err_to_name.c || (echo 'Differences found between running under Python 2 and 3.'; exit 1)
408 - pyenv global system
412 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
418 - /^v\d+\.\d+(\.\d+)?($|-)/
421 before_script: *do_nothing_before
425 - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
426 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
427 - chmod 600 ~/.ssh/id_rsa
428 - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
429 - git remote remove github &>/dev/null || true
430 - git remote add github git@github.com:espressif/esp-idf.git
431 # Need separate push commands for tag builds and for branch builds
432 - "[ -n \"${CI_COMMIT_TAG}\" ] && git push github ${CI_COMMIT_TAG}"
433 - "[ -z \"${CI_COMMIT_TAG}\" ] && git push github ${CI_COMMIT_SHA}:refs/heads/${CI_COMMIT_REF_NAME}"
437 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
443 - /^v\d+\.\d+(\.\d+)?($|-)/
447 before_script: *do_nothing_before
451 - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
452 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
453 - chmod 600 ~/.ssh/id_rsa
454 - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
455 - export GIT_VER=$(git describe --always)
458 - tar czvf $GIT_VER.tar.gz $GIT_VER
459 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/en
460 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/en && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
461 - cd ../../zh_CN/_build/
463 - tar czvf $GIT_VER.tar.gz $GIT_VER
464 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/zh_CN
465 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/zh_CN && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
466 # add link to preview doc
467 - echo "[document preview][en] $CI_DOCKER_REGISTRY/docs/esp-idf/en/${GIT_VER}/index.html"
468 - echo "[document preview][zh_CN] $CI_DOCKER_REGISTRY/docs/esp-idf/zh_CN/${GIT_VER}/index.html"
472 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
476 # can only be triggered
480 - docs/_build/linkcheck
483 # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
484 - test "$CHECK_LINKS" = "Yes" || exit 0
485 # can only run on master branch (otherwise the commit is not on Github yet)
486 - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
492 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
498 - /^v\d+\.\d+(\.\d+)?($|-)/
500 before_script: *do_nothing_before
502 - tools/ci/check-line-endings.sh ${IDF_PATH}
506 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
512 - /^v\d+\.\d+(\.\d+)?($|-)/
514 before_script: *do_nothing_before
517 - git log -n10 --oneline
518 # commit start with "WIP: " need to be squashed before merge
519 - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
523 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
529 - /^v\d+\.\d+(\.\d+)?($|-)/
531 before_script: *do_nothing_before
533 - tools/ci/check-executable.sh
535 check_submodule_sync:
537 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
543 - /^v\d+\.\d+(\.\d+)?($|-)/
547 before_script: *do_nothing_before
549 # check if all submodules are correctly synced to public repostory
550 - git submodule update --init --recursive
555 image: $CI_DOCKER_REGISTRY/ubuntu-test-env
557 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
558 # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
563 - build_esp_idf_tests
565 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
566 EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
569 - components/idf_test/*/CIConfigs
570 - components/idf_test/*/TC.sqlite
571 - $EXAMPLE_CONFIG_OUTPUT_PATH
573 before_script: *add_gitlab_key_before
575 # assign example tests
576 - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
577 # assign unit test cases
578 - python $TEST_FW_PATH/CIAssignUnitTest.py $IDF_PATH/components/idf_test/unit_test/TestCaseAll.yml $IDF_PATH/.gitlab-ci.yml $IDF_PATH/components/idf_test/unit_test/CIConfigs
579 # clone test script to assign tests
580 - git clone $TEST_SCRIPT_REPOSITORY
581 - cd auto_test_script
582 - python $CHECKOUT_REF_SCRIPT auto_test_script
583 # assgin integration test cases
584 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
586 .example_test_template: &example_test_template
587 stage: integration_test
592 - /^v\d+\.\d+(\.\d+)?($|-)/
611 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
612 TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
613 CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
614 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
615 ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
617 # first test if config file exists, if not exist, exit 0
618 - test -e $CONFIG_FILE || exit 0
619 # clone test env configs
620 - git clone $TEST_ENV_CONFIG_REPOSITORY
621 - cd ci-test-runner-configs
622 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
625 - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
627 .unit_test_template: &unit_test_template
628 <<: *example_test_template
632 - build_esp_idf_tests
634 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
635 TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
636 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
637 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
638 ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
640 .test_template: &test_template
641 stage: integration_test
646 - /^v\d+\.\d+(\.\d+)?($|-)/
660 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
661 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
662 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
663 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
664 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
665 before_script: *add_gitlab_key_before
667 # first test if config file exists, if not exist, exit 0
668 - test -e $CONFIG_FILE || exit 0
669 # clone local test env configs
670 - git clone $TEST_ENV_CONFIG_REPOSITORY
671 - cd ci-test-runner-configs
672 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
674 - git clone $TEST_SCRIPT_REPOSITORY
675 - cd auto_test_script
676 - python $CHECKOUT_REF_SCRIPT auto_test_script
678 - python CIRunner.py -l "$LOG_PATH/$CI_JOB_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH -m $MODULE_UPDATE_FILE
692 # clone local test env configs
693 - git clone $TEST_ENV_CONFIG_REPOSITORY
694 - cd ci-test-runner-configs
695 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
697 - git clone $TEST_SCRIPT_REPOSITORY
698 - cd auto_test_script
699 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
701 - ./Tools/prepare_nvs_bin.sh
703 - python CIRunner.py -l "$LOG_PATH/$CI_JOB_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH -m $MODULE_UPDATE_FILE
706 <<: *example_test_template
712 <<: *example_test_template
718 <<: *example_test_template
724 <<: *example_test_template
730 <<: *unit_test_template
736 <<: *unit_test_template
742 <<: *unit_test_template
748 <<: *unit_test_template
754 <<: *unit_test_template
760 <<: *unit_test_template
766 <<: *unit_test_template
772 <<: *unit_test_template
778 <<: *unit_test_template
784 <<: *unit_test_template
790 <<: *unit_test_template
796 <<: *unit_test_template
802 <<: *unit_test_template
808 <<: *unit_test_template
814 <<: *unit_test_template
820 <<: *unit_test_template
826 <<: *unit_test_template
832 <<: *unit_test_template
838 <<: *unit_test_template
844 <<: *unit_test_template
850 <<: *unit_test_template
856 <<: *unit_test_template
862 <<: *unit_test_template
868 <<: *unit_test_template
874 <<: *unit_test_template
880 <<: *unit_test_template
886 <<: *unit_test_template
892 <<: *unit_test_template
898 <<: *unit_test_template
904 <<: *unit_test_template
910 <<: *unit_test_template
916 <<: *unit_test_template
922 <<: *unit_test_template
928 <<: *unit_test_template
934 <<: *unit_test_template
940 <<: *unit_test_template
946 <<: *unit_test_template
952 <<: *unit_test_template
958 <<: *unit_test_template
964 <<: *unit_test_template
970 <<: *unit_test_template
976 <<: *unit_test_template
982 <<: *unit_test_template
989 <<: *unit_test_template
996 <<: *unit_test_template
1003 <<: *unit_test_template
1010 <<: *unit_test_template
1017 <<: *unit_test_template
1024 <<: *unit_test_template
1031 <<: *unit_test_template
1038 <<: *unit_test_template
1045 <<: *unit_test_template
1052 <<: *unit_test_template
1059 <<: *unit_test_template
1066 <<: *unit_test_template
1073 <<: *unit_test_template
1079 <<: *unit_test_template
1085 <<: *unit_test_template
1091 <<: *unit_test_template
1098 <<: *unit_test_template
1104 <<: *unit_test_template
1110 <<: *unit_test_template
1116 <<: *unit_test_template
1123 <<: *unit_test_template
1129 <<: *unit_test_template
1135 <<: *unit_test_template
1141 <<: *unit_test_template
1148 <<: *unit_test_template
1154 <<: *unit_test_template
1160 <<: *unit_test_template
1166 <<: *unit_test_template
1173 <<: *unit_test_template