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}"
198 # and again, with cmake!
199 - rm -rf ../build_examples_cmake
200 - mkdir ../build_examples_cmake
201 - cd ../build_examples_cmake
202 - mkdir -p ${LOG_PATH}_cmake
203 - LOG_PATH=${LOG_PATH}_cmake ${IDF_PATH}/tools/ci/build_examples_cmake.sh "${CI_JOB_NAME}"
206 <<: *build_examples_template
209 <<: *build_examples_template
212 <<: *build_examples_template
215 <<: *build_examples_template
218 <<: *build_examples_template
221 <<: *build_examples_template
224 <<: *build_examples_template
227 <<: *build_examples_template
229 # If you want to add new build example jobs, please add it into dependencies of `.example_test_template`
233 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
239 # English version of documentation
240 - docs/en/doxygen-warning-log.txt
241 - docs/en/sphinx-warning-log.txt
242 - docs/en/sphinx-warning-log-sanitized.txt
243 - docs/en/_build/html
244 # Chinese version of documentation
245 - docs/zh_CN/doxygen-warning-log.txt
246 - docs/zh_CN/sphinx-warning-log.txt
247 - docs/zh_CN/sphinx-warning-log-sanitized.txt
248 - docs/zh_CN/_build/html
252 - ./check_lang_folder_sync.sh
256 - ../check_doc_warnings.sh
260 - ../check_doc_warnings.sh
264 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
266 tools/cmake/run_cmake_lint.sh
268 .host_test_template: &host_test_template
270 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
276 <<: *host_test_template
278 - cd components/nvs_flash/test_nvs_host
282 <<: *host_test_template
285 - components/nvs_flash/test_nvs_host/coverage_report
288 # This job takes a few hours to finish, so only run it on demand
290 BOT_NEEDS_TRIGGER_BY_NAME: 1
292 - cd components/nvs_flash/test_nvs_host
293 - make coverage_report
295 test_partition_table_on_host:
296 <<: *host_test_template
300 - cd components/partition_table/test_gen_esp32part_host
301 - ./gen_esp32part_tests.py
304 <<: *host_test_template
307 - components/wear_levelling/test_wl_host/coverage_report.zip
309 - cd components/wear_levelling/test_wl_host
313 <<: *host_test_template
315 - cd components/fatfs/test_fatfs_host/
318 test_mdns_fuzzer_on_host:
320 image: $CI_DOCKER_REGISTRY/afl-fuzzer-test
327 - components/mdns/test_afl_fuzz_host/out/crashes
330 # can only be triggered
333 BOT_NEEDS_TRIGGER_BY_NAME: 1
335 - export AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 && export AFL_SKIP_CPUFREQ=1
336 - cd components/mdns/test_afl_fuzz_host/
337 # run AFL fuzzer for one hour
338 - ( make fuzz || pkill sleep ) &
339 - ( sleep 3600 || mkdir -p out/crashes/env_failed ) && pkill afl-fuz
340 # check no crashes found
341 - "[ -z `ls out/crashes/` ] || exit 1"
344 <<: *host_test_template
346 - cd components/spiffs/test_spiffs_host/
349 test_multi_heap_on_host:
350 <<: *host_test_template
352 - cd components/heap/test_multi_heap_host
353 - ./test_all_configs.sh
356 <<: *host_test_template
358 - cd tools/kconfig_new/test
359 - ./test_confserver.py
362 <<: *host_test_template
364 - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
365 - rm -rf test_build_system
366 - mkdir test_build_system
367 - cd test_build_system
368 - ${IDF_PATH}/tools/ci/test_build_system.sh
370 test_build_system_cmake:
371 <<: *host_test_template
373 - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
374 - rm -rf test_build_system
375 - mkdir test_build_system
376 - cd test_build_system
377 - ${IDF_PATH}/tools/ci/test_build_system_cmake.sh
380 <<: *host_test_template
384 - tools/test_idf_monitor/outputs/*
387 - cd ${IDF_PATH}/tools/test_idf_monitor
388 - ./run_test_idf_monitor.py
390 test_esp_err_to_name_on_host:
391 <<: *host_test_template
394 - ./gen_esp_err_to_name.py
395 - 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)
399 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
405 - /^v\d+\.\d+(\.\d+)?($|-)/
408 before_script: *do_nothing_before
412 - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
413 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
414 - chmod 600 ~/.ssh/id_rsa
415 - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
416 - git remote remove github &>/dev/null || true
417 - git remote add github git@github.com:espressif/esp-idf.git
418 # Need separate push commands for tag builds and for branch builds
419 - "[ -n \"${CI_COMMIT_TAG}\" ] && git push github ${CI_COMMIT_TAG}"
420 - "[ -z \"${CI_COMMIT_TAG}\" ] && git push github ${CI_COMMIT_SHA}:refs/heads/${CI_COMMIT_REF_NAME}"
424 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
430 - /^v\d+\.\d+(\.\d+)?($|-)/
434 before_script: *do_nothing_before
438 - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
439 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
440 - chmod 600 ~/.ssh/id_rsa
441 - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
442 - export GIT_VER=$(git describe --always)
445 - tar czvf $GIT_VER.tar.gz $GIT_VER
446 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/en
447 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/en && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
448 - cd ../../zh_CN/_build/
450 - tar czvf $GIT_VER.tar.gz $GIT_VER
451 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/zh_CN
452 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/zh_CN && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
453 # add link to preview doc
454 - echo "[document preview][en] $CI_DOCKER_REGISTRY/docs/esp-idf/en/${GIT_VER}/index.html"
455 - echo "[document preview][zh_CN] $CI_DOCKER_REGISTRY/docs/esp-idf/zh_CN/${GIT_VER}/index.html"
459 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
463 # can only be triggered
467 - docs/_build/linkcheck
470 # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
471 - test "$CHECK_LINKS" = "Yes" || exit 0
472 # can only run on master branch (otherwise the commit is not on Github yet)
473 - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
479 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
485 - /^v\d+\.\d+(\.\d+)?($|-)/
487 before_script: *do_nothing_before
489 - tools/ci/check-line-endings.sh ${IDF_PATH}
493 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
499 - /^v\d+\.\d+(\.\d+)?($|-)/
501 before_script: *do_nothing_before
504 - git log -n10 --oneline
505 # commit start with "WIP: " need to be squashed before merge
506 - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
510 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
516 - /^v\d+\.\d+(\.\d+)?($|-)/
518 before_script: *do_nothing_before
520 - tools/ci/check-executable.sh
522 check_submodule_sync:
524 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
530 - /^v\d+\.\d+(\.\d+)?($|-)/
534 before_script: *do_nothing_before
536 # check if all submodules are correctly synced to public repostory
537 - git submodule update --init --recursive
542 image: $CI_DOCKER_REGISTRY/ubuntu-test-env
544 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
545 # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
550 - build_esp_idf_tests
552 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
553 EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
556 - components/idf_test/*/CIConfigs
557 - components/idf_test/*/TC.sqlite
558 - $EXAMPLE_CONFIG_OUTPUT_PATH
560 before_script: *add_gitlab_key_before
562 # assign example tests
563 - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
564 # assign unit test cases
565 - 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
566 # clone test script to assign tests
567 - git clone $TEST_SCRIPT_REPOSITORY
568 - cd auto_test_script
569 - python $CHECKOUT_REF_SCRIPT auto_test_script
570 # assgin integration test cases
571 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
573 .example_test_template: &example_test_template
574 stage: integration_test
579 - /^v\d+\.\d+(\.\d+)?($|-)/
598 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
599 TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
600 CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
601 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
602 ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
604 # first test if config file exists, if not exist, exit 0
605 - test -e $CONFIG_FILE || exit 0
606 # clone test env configs
607 - git clone $TEST_ENV_CONFIG_REPOSITORY
608 - cd ci-test-runner-configs
609 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
612 - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
614 .unit_test_template: &unit_test_template
615 <<: *example_test_template
619 - build_esp_idf_tests
621 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
622 TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
623 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$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"
627 .test_template: &test_template
628 stage: integration_test
633 - /^v\d+\.\d+(\.\d+)?($|-)/
647 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
648 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
649 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
650 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
651 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
652 before_script: *add_gitlab_key_before
654 # first test if config file exists, if not exist, exit 0
655 - test -e $CONFIG_FILE || exit 0
656 # clone local test env configs
657 - git clone $TEST_ENV_CONFIG_REPOSITORY
658 - cd ci-test-runner-configs
659 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
661 - git clone $TEST_SCRIPT_REPOSITORY
662 - cd auto_test_script
663 - python $CHECKOUT_REF_SCRIPT auto_test_script
665 - 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
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
684 - git clone $TEST_SCRIPT_REPOSITORY
685 - cd auto_test_script
686 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
688 - ./Tools/prepare_nvs_bin.sh
690 - 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
693 <<: *example_test_template
699 <<: *example_test_template
705 <<: *example_test_template
711 <<: *example_test_template
717 <<: *unit_test_template
723 <<: *unit_test_template
729 <<: *unit_test_template
735 <<: *unit_test_template
741 <<: *unit_test_template
747 <<: *unit_test_template
753 <<: *unit_test_template
759 <<: *unit_test_template
765 <<: *unit_test_template
771 <<: *unit_test_template
777 <<: *unit_test_template
783 <<: *unit_test_template
789 <<: *unit_test_template
795 <<: *unit_test_template
801 <<: *unit_test_template
807 <<: *unit_test_template
813 <<: *unit_test_template
819 <<: *unit_test_template
825 <<: *unit_test_template
831 <<: *unit_test_template
837 <<: *unit_test_template
843 <<: *unit_test_template
849 <<: *unit_test_template
855 <<: *unit_test_template
861 <<: *unit_test_template
867 <<: *unit_test_template
873 <<: *unit_test_template
879 <<: *unit_test_template
885 <<: *unit_test_template
891 <<: *unit_test_template
897 <<: *unit_test_template
903 <<: *unit_test_template
909 <<: *unit_test_template
915 <<: *unit_test_template
921 <<: *unit_test_template
927 <<: *unit_test_template
933 <<: *unit_test_template
939 <<: *unit_test_template
945 <<: *unit_test_template
951 <<: *unit_test_template
957 <<: *unit_test_template
964 <<: *unit_test_template
971 <<: *unit_test_template
978 <<: *unit_test_template
985 <<: *unit_test_template
992 <<: *unit_test_template
999 <<: *unit_test_template
1006 <<: *unit_test_template
1013 <<: *unit_test_template
1020 <<: *unit_test_template
1027 <<: *unit_test_template
1034 <<: *unit_test_template
1041 <<: *unit_test_template
1048 <<: *unit_test_template
1054 <<: *unit_test_template
1060 <<: *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