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 - source /opt/pyenv/activate
395 - pyenv global 2.7.15
396 - ./run_test_idf_monitor.py
398 - ./run_test_idf_monitor.py
399 - pyenv global system
402 <<: *host_test_template
406 - tools/test_idf_size/output
407 - tools/test_idf_size/.coverage
410 - cd ${IDF_PATH}/tools/test_idf_size
411 - source /opt/pyenv/activate
412 - pyenv global 2.7.15
416 - pyenv global system
418 test_esp_err_to_name_on_host:
419 <<: *host_test_template
423 - components/esp32/esp_err_to_name.c
427 - source /opt/pyenv/activate
428 - pyenv global 2.7.15
429 - ./gen_esp_err_to_name.py
430 - git diff --exit-code -- ../components/esp32/esp_err_to_name.c || (echo 'Differences found. Please run gen_esp_err_to_name.py and commit the changes.'; exit 1)
432 - ./gen_esp_err_to_name.py
433 - git diff --exit-code -- ../components/esp32/esp_err_to_name.c || (echo 'Differences found between running under Python 2 and 3.'; exit 1)
434 - pyenv global system
438 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
444 - /^v\d+\.\d+(\.\d+)?($|-)/
447 before_script: *do_nothing_before
451 - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
452 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
453 - chmod 600 ~/.ssh/id_rsa
454 - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
455 - git remote remove github &>/dev/null || true
456 - git remote add github git@github.com:espressif/esp-idf.git
457 - tools/ci/push_to_github.sh
461 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
467 - /^v\d+\.\d+(\.\d+)?($|-)/
471 before_script: *do_nothing_before
475 - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
476 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
477 - chmod 600 ~/.ssh/id_rsa
478 - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
479 - export GIT_VER=$(git describe --always)
482 - tar czvf $GIT_VER.tar.gz $GIT_VER
483 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/en
484 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/en && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
485 - cd ../../zh_CN/_build/
487 - tar czvf $GIT_VER.tar.gz $GIT_VER
488 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/zh_CN
489 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/zh_CN && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
490 # add link to preview doc
491 - echo "[document preview][en] $CI_DOCKER_REGISTRY/docs/esp-idf/en/${GIT_VER}/index.html"
492 - echo "[document preview][zh_CN] $CI_DOCKER_REGISTRY/docs/esp-idf/zh_CN/${GIT_VER}/index.html"
496 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
500 # can only be triggered
504 - docs/_build/linkcheck
507 # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
508 - test "$CHECK_LINKS" = "Yes" || exit 0
509 # can only run on master branch (otherwise the commit is not on Github yet)
510 - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
516 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
520 before_script: *do_nothing_before_no_filter
522 - tools/ci/check-line-endings.sh ${IDF_PATH}
526 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
530 before_script: *do_nothing_before_no_filter
533 - git log -n10 --oneline
534 # commit start with "WIP: " need to be squashed before merge
535 - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
539 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
543 before_script: *do_nothing_before_no_filter
545 - tools/ci/check-executable.sh
547 check_submodule_sync:
549 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
555 before_script: *do_nothing_before_no_filter
557 # check if all submodules are correctly synced to public repostory
558 - git submodule update --init --recursive
563 image: $CI_DOCKER_REGISTRY/ubuntu-test-env
565 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
566 # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
571 - build_esp_idf_tests
573 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
574 EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
577 - components/idf_test/*/CIConfigs
578 - components/idf_test/*/TC.sqlite
579 - $EXAMPLE_CONFIG_OUTPUT_PATH
581 before_script: *add_gitlab_key_before
583 # assign example tests
584 - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
585 # assign unit test cases
586 - 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
587 # clone test script to assign tests
588 - git clone $TEST_SCRIPT_REPOSITORY
589 - cd auto_test_script
590 - python $CHECKOUT_REF_SCRIPT auto_test_script
591 # assgin integration test cases
592 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
594 .example_test_template: &example_test_template
595 stage: integration_test
600 - /^v\d+\.\d+(\.\d+)?($|-)/
619 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
620 TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
621 CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
622 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
623 ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
625 # first test if config file exists, if not exist, exit 0
626 - test -e $CONFIG_FILE || exit 0
627 # clone test env configs
628 - git clone $TEST_ENV_CONFIG_REPOSITORY
629 - cd ci-test-runner-configs
630 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
633 - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
635 .unit_test_template: &unit_test_template
636 <<: *example_test_template
640 - build_esp_idf_tests
642 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
643 TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
644 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
645 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
646 ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
648 .test_template: &test_template
649 stage: integration_test
654 - /^v\d+\.\d+(\.\d+)?($|-)/
668 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
669 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
670 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
671 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
672 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
673 before_script: *add_gitlab_key_before
675 # first test if config file exists, if not exist, exit 0
676 - test -e $CONFIG_FILE || exit 0
677 # clone local test env configs
678 - git clone $TEST_ENV_CONFIG_REPOSITORY
679 - cd ci-test-runner-configs
680 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
682 - git clone $TEST_SCRIPT_REPOSITORY
683 - cd auto_test_script
684 - python $CHECKOUT_REF_SCRIPT auto_test_script
686 - 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 # clone local test env configs
701 - git clone $TEST_ENV_CONFIG_REPOSITORY
702 - cd ci-test-runner-configs
703 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
705 - git clone $TEST_SCRIPT_REPOSITORY
706 - cd auto_test_script
707 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
709 - ./Tools/prepare_nvs_bin.sh
711 - python CIRunner.py -l "$LOG_PATH/$CI_JOB_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH -m $MODULE_UPDATE_FILE
714 <<: *example_test_template
720 <<: *example_test_template
726 <<: *example_test_template
732 <<: *example_test_template
738 <<: *unit_test_template
744 <<: *unit_test_template
750 <<: *unit_test_template
756 <<: *unit_test_template
762 <<: *unit_test_template
768 <<: *unit_test_template
774 <<: *unit_test_template
780 <<: *unit_test_template
786 <<: *unit_test_template
792 <<: *unit_test_template
798 <<: *unit_test_template
804 <<: *unit_test_template
810 <<: *unit_test_template
816 <<: *unit_test_template
822 <<: *unit_test_template
828 <<: *unit_test_template
834 <<: *unit_test_template
840 <<: *unit_test_template
846 <<: *unit_test_template
852 <<: *unit_test_template
858 <<: *unit_test_template
864 <<: *unit_test_template
870 <<: *unit_test_template
876 <<: *unit_test_template
882 <<: *unit_test_template
888 <<: *unit_test_template
894 <<: *unit_test_template
900 <<: *unit_test_template
906 <<: *unit_test_template
912 <<: *unit_test_template
918 <<: *unit_test_template
924 <<: *unit_test_template
930 <<: *unit_test_template
936 <<: *unit_test_template
942 <<: *unit_test_template
948 <<: *unit_test_template
954 <<: *unit_test_template
960 <<: *unit_test_template
966 <<: *unit_test_template
972 <<: *unit_test_template
978 <<: *unit_test_template
984 <<: *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
1074 <<: *unit_test_template
1081 <<: *unit_test_template
1087 <<: *unit_test_template
1093 <<: *unit_test_template
1099 <<: *unit_test_template
1106 <<: *unit_test_template
1112 <<: *unit_test_template
1118 <<: *unit_test_template
1124 <<: *unit_test_template
1131 <<: *unit_test_template
1137 <<: *unit_test_template
1143 <<: *unit_test_template
1149 <<: *unit_test_template
1156 <<: *unit_test_template
1162 <<: *unit_test_template
1168 <<: *unit_test_template
1174 <<: *unit_test_template
1181 <<: *unit_test_template
1187 <<: *unit_test_template
1193 <<: *unit_test_template
1199 <<: *unit_test_template