13 # Common parameters for the 'make' during CI tests
14 MAKEFLAGS: "-j5 --no-keep-going"
16 # GitLab-CI environment
18 # more attempts for more robust
19 GET_SOURCES_ATTEMPTS: "10"
20 ARTIFACT_DOWNLOAD_ATTEMPTS: "10"
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)
25 GIT_SUBMODULE_STRATEGY: none
29 IDF_PATH: "$CI_PROJECT_DIR"
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"
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
40 .git_clean_stale_submodules: &git_clean_stale_submodules >
41 find . -name '.git' -not -path './.git' -printf '%P\n'
44 grep -q {} .gitmodules
45 || (echo "Removing {}, has .git directory but not in .gitmodules file"
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
53 - *git_clean_stale_submodules
54 # apply bot filter in before script
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
64 # Set IS_PRIVATE or IS_PUBLIC depending on if our branch is public or not
66 # (the same regular expressions are used to set these are used in 'only:' sections below
67 - source tools/ci/configure_ci_environment.sh
69 # fetch the submodules (& if necessary re-fetch repo) from gitlab
70 - time ./tools/ci/get-full-sources.sh
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
77 # used for everything else where we want to do no prep, except for bot filter
79 before_script: &do_nothing_before
80 - *git_clean_stale_submodules
81 # apply bot filter in before script
83 - echo "Not setting up GitLab key, not fetching submodules"
84 - source tools/ci/configure_ci_environment.sh
86 .add_gitlab_key_before:
87 before_script: &add_gitlab_key_before
88 - *git_clean_stale_submodules
89 # apply bot filter in before script
91 - echo "Not fetching submodules"
92 - source tools/ci/configure_ci_environment.sh
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
103 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
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
115 - python $CHECKOUT_REF_SCRIPT esp-idf-template
116 # Test debug build (default)
118 # Now test release build
120 - sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
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
128 .build_template: &build_template
130 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
137 .build_ssc_template: &build_ssc_template
144 SSC_CONFIG_FOLDER: "$CI_PROJECT_DIR/SSC/configs/ESP32_IDF"
146 - git clone $SSC_REPOSITORY
148 - python $CHECKOUT_REF_SCRIPT SSC
149 - MAKEFLAGS= ./ci_build_ssc.sh "${CI_JOB_NAME}" "${IDF_PATH}/.gitlab-ci.yml"
151 # don't forget to add to dependency to test_template when adding new build_ssc jobs
153 <<: *build_ssc_template
156 <<: *build_ssc_template
159 <<: *build_ssc_template
161 # If you want to add new build ssc jobs, please add it into dependencies of `assign_test` and `.test_template`
167 - tools/unit-test-app/output
168 - components/idf_test/unit_test/TestCaseAll.yml
169 - components/idf_test/unit_test/CIConfigs/*.yml
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
180 .build_examples_template: &build_examples_template
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
195 LOG_PATH: "$CI_PROJECT_DIR/log_examples"
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
202 # build some of examples
203 - mkdir -p ${LOG_PATH}
204 - ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
207 <<: *build_examples_template
210 <<: *build_examples_template
213 <<: *build_examples_template
216 <<: *build_examples_template
219 <<: *build_examples_template
222 <<: *build_examples_template
225 <<: *build_examples_template
228 <<: *build_examples_template
230 # If you want to add new build example jobs, please add it into dependencies of `.example_test_template`
234 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
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
253 - ./check_lang_folder_sync.sh
257 - ../check_doc_warnings.sh
261 - ../check_doc_warnings.sh
263 .host_test_template: &host_test_template
265 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
271 <<: *host_test_template
273 - cd components/nvs_flash/test_nvs_host
277 <<: *host_test_template
280 - components/nvs_flash/test_nvs_host/coverage_report
283 # This job takes a few hours to finish, so only run it on demand
285 BOT_NEEDS_TRIGGER_BY_NAME: 1
287 - cd components/nvs_flash/test_nvs_host
288 - make coverage_report
290 test_partition_table_on_host:
291 <<: *host_test_template
295 - cd components/partition_table/test_gen_esp32part_host
296 - ./gen_esp32part_tests.py
299 <<: *host_test_template
302 - components/wear_levelling/test_wl_host/coverage_report.zip
304 - cd components/wear_levelling/test_wl_host
308 <<: *host_test_template
310 - cd components/fatfs/test_fatfs_host/
313 .host_fuzzer_test_template: &host_fuzzer_test_template
315 image: $CI_DOCKER_REGISTRY/afl-fuzzer-test
322 - ${FUZZER_TEST_DIR}/out/crashes
323 - ${FUZZER_TEST_DIR}/fuzz_output.log
326 # can only be triggered
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
337 test_mdns_fuzzer_on_host:
338 <<: *host_fuzzer_test_template
340 BOT_NEEDS_TRIGGER_BY_NAME: 1
341 FUZZER_TEST_DIR: components/mdns/test_afl_fuzz_host
343 test_lwip_dns_fuzzer_on_host:
344 <<: *host_fuzzer_test_template
346 BOT_NEEDS_TRIGGER_BY_NAME: 1
347 FUZZER_TEST_DIR: components/lwip/test_afl_host
348 FUZZER_PARAMS: MODE=dns
350 test_lwip_dhcp_fuzzer_on_host:
351 <<: *host_fuzzer_test_template
353 BOT_NEEDS_TRIGGER_BY_NAME: 1
354 FUZZER_TEST_DIR: components/lwip/test_afl_host
355 FUZZER_PARAMS: MODE=dhcp_client
357 test_lwip_dhcps_fuzzer_on_host:
358 <<: *host_fuzzer_test_template
360 BOT_NEEDS_TRIGGER_BY_NAME: 1
361 FUZZER_TEST_DIR: components/lwip/test_afl_host
362 FUZZER_PARAMS: MODE=dhcp_server
365 <<: *host_test_template
367 - cd components/spiffs/test_spiffs_host/
370 test_multi_heap_on_host:
371 <<: *host_test_template
373 - cd components/heap/test_multi_heap_host
374 - ./test_all_configs.sh
377 <<: *host_test_template
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
386 <<: *host_test_template
390 - tools/test_idf_monitor/outputs/*
393 - cd ${IDF_PATH}/tools/test_idf_monitor
394 - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh ./run_test_idf_monitor.py
397 <<: *host_test_template
401 - tools/test_idf_size/output
402 - tools/test_idf_size/.coverage
405 - cd ${IDF_PATH}/tools/test_idf_size
406 - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh ./test.sh
408 test_esp_err_to_name_on_host:
409 <<: *host_test_template
413 - components/esp32/esp_err_to_name.c
416 - cd ${IDF_PATH}/tools/
417 - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 2.7.15 ./gen_esp_err_to_name.py
418 - 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)
419 - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 3.4.8 ./gen_esp_err_to_name.py
420 - git diff --exit-code -- ../components/esp32/esp_err_to_name.c || (echo 'Differences found between running under Python 2 and 3.'; exit 1)
424 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
430 - /^v\d+\.\d+(\.\d+)?($|-)/
433 before_script: *do_nothing_before
437 - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
438 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
439 - chmod 600 ~/.ssh/id_rsa
440 - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
441 - git remote remove github &>/dev/null || true
442 - git remote add github git@github.com:espressif/esp-idf.git
443 - tools/ci/push_to_github.sh
447 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
453 - /^v\d+\.\d+(\.\d+)?($|-)/
457 before_script: *do_nothing_before
461 - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
462 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
463 - chmod 600 ~/.ssh/id_rsa
464 - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
465 - export GIT_VER=$(git describe --always)
468 - tar czvf $GIT_VER.tar.gz $GIT_VER
469 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/en
470 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/en && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
471 - cd ../../zh_CN/_build/
473 - tar czvf $GIT_VER.tar.gz $GIT_VER
474 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/zh_CN
475 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/zh_CN && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
476 # add link to preview doc
477 - echo "[document preview][en] $CI_DOCKER_REGISTRY/docs/esp-idf/en/${GIT_VER}/index.html"
478 - echo "[document preview][zh_CN] $CI_DOCKER_REGISTRY/docs/esp-idf/zh_CN/${GIT_VER}/index.html"
482 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
486 # can only be triggered
490 - docs/_build/linkcheck
493 # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
494 - test "$CHECK_LINKS" = "Yes" || exit 0
495 # can only run on master branch (otherwise the commit is not on Github yet)
496 - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
502 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
506 before_script: *do_nothing_before_no_filter
508 - tools/ci/check-line-endings.sh ${IDF_PATH}
512 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
516 before_script: *do_nothing_before_no_filter
519 - git log -n10 --oneline
520 # commit start with "WIP: " need to be squashed before merge
521 - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
525 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
529 before_script: *do_nothing_before_no_filter
531 - tools/ci/check-executable.sh
533 check_submodule_sync:
535 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
541 before_script: *do_nothing_before_no_filter
543 # check if all submodules are correctly synced to public repostory
544 - git submodule update --init --recursive
549 image: $CI_DOCKER_REGISTRY/ubuntu-test-env
551 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
552 # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
557 - build_esp_idf_tests
559 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
560 EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
563 - components/idf_test/*/CIConfigs
564 - components/idf_test/*/TC.sqlite
565 - $EXAMPLE_CONFIG_OUTPUT_PATH
567 before_script: *add_gitlab_key_before
569 # assign example tests
570 - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
571 # assign unit test cases
572 - 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
573 # clone test script to assign tests
574 - git clone $TEST_SCRIPT_REPOSITORY
575 - cd auto_test_script
576 - python $CHECKOUT_REF_SCRIPT auto_test_script
577 # assgin integration test cases
578 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
580 .example_test_template: &example_test_template
581 stage: integration_test
586 - /^v\d+\.\d+(\.\d+)?($|-)/
605 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
606 TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
607 CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
608 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
609 ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
611 # first test if config file exists, if not exist, exit 0
612 - test -e $CONFIG_FILE || exit 0
613 # clone test env configs
614 - git clone $TEST_ENV_CONFIG_REPOSITORY
615 - cd ci-test-runner-configs
616 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
619 - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
621 .unit_test_template: &unit_test_template
622 <<: *example_test_template
626 - build_esp_idf_tests
628 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
629 TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
630 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
631 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
632 ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
634 .test_template: &test_template
635 stage: integration_test
640 - /^v\d+\.\d+(\.\d+)?($|-)/
654 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
655 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
656 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
657 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
658 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
659 before_script: *add_gitlab_key_before
661 # first test if config file exists, if not exist, exit 0
662 - test -e $CONFIG_FILE || exit 0
663 # clone local test env configs
664 - git clone $TEST_ENV_CONFIG_REPOSITORY
665 - cd ci-test-runner-configs
666 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
668 - git clone $TEST_SCRIPT_REPOSITORY
669 - cd auto_test_script
670 - python $CHECKOUT_REF_SCRIPT auto_test_script
672 - 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
686 # clone local test env configs
687 - git clone $TEST_ENV_CONFIG_REPOSITORY
688 - cd ci-test-runner-configs
689 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
691 - git clone $TEST_SCRIPT_REPOSITORY
692 - cd auto_test_script
693 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
695 - ./Tools/prepare_nvs_bin.sh
697 - 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
700 <<: *example_test_template
706 <<: *example_test_template
712 <<: *example_test_template
718 <<: *example_test_template
724 <<: *unit_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
983 <<: *unit_test_template
990 <<: *unit_test_template
997 <<: *unit_test_template
1004 <<: *unit_test_template
1011 <<: *unit_test_template
1018 <<: *unit_test_template
1025 <<: *unit_test_template
1032 <<: *unit_test_template
1039 <<: *unit_test_template
1046 <<: *unit_test_template
1053 <<: *unit_test_template
1060 <<: *unit_test_template
1067 <<: *unit_test_template
1073 <<: *unit_test_template
1079 <<: *unit_test_template
1085 <<: *unit_test_template
1092 <<: *unit_test_template
1098 <<: *unit_test_template
1104 <<: *unit_test_template
1110 <<: *unit_test_template
1117 <<: *unit_test_template
1123 <<: *unit_test_template
1129 <<: *unit_test_template
1135 <<: *unit_test_template
1142 <<: *unit_test_template
1148 <<: *unit_test_template
1154 <<: *unit_test_template
1160 <<: *unit_test_template
1167 <<: *unit_test_template
1173 <<: *unit_test_template
1179 <<: *unit_test_template
1185 <<: *unit_test_template