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
158 - tools/unit-test-app/output
159 - components/idf_test/unit_test/TestCaseAll.yml
160 - components/idf_test/unit_test/CIConfigs/*.yml
163 - cd tools/unit-test-app
164 - MAKEFLAGS= make help # make sure kconfig tools are built in single process
165 - make ut-clean-all-configs
166 - export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
167 - export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
168 - make ut-build-all-configs
169 - python tools/UnitTestParser.py
171 .build_examples_template: &build_examples_template
177 - build_examples/*/*/*/build/*.bin
178 - build_examples/*/*/*/build/*.elf
179 - build_examples/*/*/*/build/*.map
180 - build_examples/*/*/*/build/download.config
181 - build_examples/*/*/*/build/bootloader/*.bin
186 LOG_PATH: "$CI_PROJECT_DIR/log_examples"
188 # it's not possible to build 100% out-of-tree and have the "artifacts"
189 # mechanism work, but this is the next best thing
190 - rm -rf build_examples
191 - mkdir build_examples
193 # build some of examples
194 - mkdir -p ${LOG_PATH}
195 - ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
198 <<: *build_examples_template
201 <<: *build_examples_template
204 <<: *build_examples_template
207 <<: *build_examples_template
210 <<: *build_examples_template
213 <<: *build_examples_template
216 <<: *build_examples_template
219 <<: *build_examples_template
224 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
230 # English version of documentation
231 - docs/en/doxygen-warning-log.txt
232 - docs/en/sphinx-warning-log.txt
233 - docs/en/sphinx-warning-log-sanitized.txt
234 - docs/en/_build/html
235 # Chinese version of documentation
236 - docs/zh_CN/doxygen-warning-log.txt
237 - docs/zh_CN/sphinx-warning-log.txt
238 - docs/zh_CN/sphinx-warning-log-sanitized.txt
239 - docs/zh_CN/_build/html
243 - ./check_lang_folder_sync.sh
247 - ../check_doc_warnings.sh
251 - ../check_doc_warnings.sh
255 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
260 - cd components/nvs_flash/test_nvs_host
265 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
271 - components/nvs_flash/test_nvs_host/coverage_report
274 # This job takes a few hours to finish, so only run it on demand
276 BOT_NEEDS_TRIGGER_BY_NAME: 1
278 - cd components/nvs_flash/test_nvs_host
279 - make coverage_report
281 test_partition_table_on_host:
283 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
288 - cd components/partition_table/test_gen_esp32part_host
289 - ./gen_esp32part_tests.py
293 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
298 - components/wear_levelling/test_wl_host/coverage_report.zip
301 - cd components/wear_levelling/test_wl_host
306 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
311 - cd components/fatfs/test_fatfs_host/
316 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
321 - cd components/spiffs/test_spiffs_host/
324 test_multi_heap_on_host:
326 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
330 - cd components/heap/test_multi_heap_host
331 - ./test_all_configs.sh
335 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
340 - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
341 - rm -rf test_build_system
342 - mkdir test_build_system
343 - cd test_build_system
344 - ${IDF_PATH}/tools/ci/test_build_system.sh
348 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
356 - /^v\d+\.\d+(\.\d+)?($|-)/
358 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
359 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test"
360 REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report"
361 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/tools/unit-test-app/tools/ModuleDefinition.yml"
363 #We need all UT* and IT* artifacts except for only a few other
372 - VER_NUM=`git rev-list HEAD | wc -l | awk '{print $1}'`
373 - SHA_ID=`echo $CI_COMMIT_SHA | cut -c 1-7`
374 - REVISION="${VER_NUM}_${SHA_ID}"
375 # replace / to _ in branch name
376 - ESCAPED_BRANCH_NAME=`echo $CI_COMMIT_REF_NAME | sed 's/\//___/g'`
377 # result path and artifacts path
378 - RESULT_PATH="$CI_PROJECT_NAME/$ESCAPED_BRANCH_NAME/$REVISION"
379 - ARTIFACTS_PATH="$GITLAB_HTTP_SERVER/idf/esp-idf/builds/$CI_JOB_ID/artifacts/browse/$CI_COMMIT_SHA"
381 - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
382 - cd auto_test_script
383 - python $CHECKOUT_REF_SCRIPT auto_test_script
386 - python CITestReport.py -l $LOG_PATH -t $TEST_CASE_FILE_PATH -p $REPORT_PATH -r $RESULT_PATH -a $ARTIFACTS_PATH -m $MODULE_UPDATE_FILE || TEST_RESULT=Fail
387 # commit to CI-test-result project
388 - git clone $GITLAB_SSH_SERVER/qa/CI-test-result.git
389 - rm -rf "CI-test-result/RawData/$RESULT_PATH"
390 - cp -R $CI_PROJECT_NAME CI-test-result/RawData
393 - git config --global user.email "ci-test-result@espressif.com"
394 - git config --global user.name "ci-test-result"
397 - git commit . -m "update test result for $CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA, pipeline ID $CI_PIPELINE_ID" || exit 0
398 - git push origin master
399 - test "${TEST_RESULT}" = "Pass" || exit 1
401 test_esp_err_to_name_on_host:
403 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
409 - ./gen_esp_err_to_name.py
410 - 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)
412 push_master_to_github:
414 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
420 - /^v\d+\.\d+(\.\d+)?($|-)/
424 GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
425 before_script: *do_nothing_before
429 - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
430 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
431 - chmod 600 ~/.ssh/id_rsa
432 - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
433 - git remote remove github &>/dev/null || true
434 - git remote add github git@github.com:espressif/esp-idf.git
435 # What the next line of script does: goes through the list of refs for all branches we push to github,
436 # generates a snippet of shell which is evaluated. The snippet checks CI_COMMIT_SHA against the SHA
437 # (aka objectname) at tip of each branch, and if any SHAs match then it checks out the local branch
438 # and then pushes that ref to a corresponding github branch
439 - eval $(git for-each-ref --shell bash --format 'if [ $CI_COMMIT_SHA == %(objectname) ]; then git checkout -B %(refname:strip=3); git push --follow-tags github %(refname:strip=3); fi;' $GITHUB_PUSH_REFS)
444 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
450 - /^v\d+\.\d+(\.\d+)?($|-)/
454 before_script: *do_nothing_before
458 - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
459 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
460 - chmod 600 ~/.ssh/id_rsa
461 - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
462 - export GIT_VER=$(git describe --always)
465 - tar czvf $GIT_VER.tar.gz $GIT_VER
466 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/en
467 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/en && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
468 - cd ../../zh_CN/_build/
470 - tar czvf $GIT_VER.tar.gz $GIT_VER
471 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/zh_CN
472 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/zh_CN && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
473 # add link to preview doc
474 - echo "[document preview][en] $CI_DOCKER_REGISTRY/docs/esp-idf/en/${GIT_VER}/index.html"
475 - echo "[document preview][zh_CN] $CI_DOCKER_REGISTRY/docs/esp-idf/zh_CN/${GIT_VER}/index.html"
479 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
483 # can only be triggered
487 - docs/_build/linkcheck
490 # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
491 - test "$CHECK_LINKS" = "Yes" || exit 0
492 # can only run on master branch (otherwise the commit is not on Github yet)
493 - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
499 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
505 - /^v\d+\.\d+(\.\d+)?($|-)/
507 before_script: *do_nothing_before
510 - git log -n10 --oneline
511 # commit start with "WIP: " need to be squashed before merge
512 - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
516 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
522 - /^v\d+\.\d+(\.\d+)?($|-)/
524 before_script: *do_nothing_before
526 - tools/ci/check-executable.sh
528 check_submodule_sync:
530 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
536 - /^v\d+\.\d+(\.\d+)?($|-)/
540 before_script: *do_nothing_before
542 # check if all submodules are correctly synced to public repostory
543 - git submodule update --init --recursive
548 image: $CI_DOCKER_REGISTRY/ubuntu-test-env$BOT_DOCKER_IMAGE_TAG
550 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
551 # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
556 - build_esp_idf_tests
558 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
559 EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
562 - components/idf_test/*/CIConfigs
563 - components/idf_test/*/TC.sqlite
564 - $EXAMPLE_CONFIG_OUTPUT_PATH
566 before_script: *add_gitlab_key_before
568 # assign example tests
569 - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
570 # assign unit test cases
571 - 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
572 # clone test script to assign tests
573 - git clone $TEST_SCRIPT_REPOSITORY
574 - cd auto_test_script
575 - python $CHECKOUT_REF_SCRIPT auto_test_script
576 # assgin integration test cases
577 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
579 .example_test_template: &example_test_template
585 - /^v\d+\.\d+(\.\d+)?($|-)/
588 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
589 # we have a lot build example jobs and the binaries them exceed the limitation of artifacts.
590 # we can't artifact them in one job. For example test jobs, download all artifacts from previous stages.
597 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
598 TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
599 CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
600 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
601 ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
603 # first test if config file exists, if not exist, exit 0
604 - test -e $CONFIG_FILE || exit 0
605 # clone test env configs
606 - git clone $TEST_ENV_CONFIG_REPOSITORY
607 - cd ci-test-runner-configs
608 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
611 - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
613 .unit_test_template: &unit_test_template
614 <<: *example_test_template
618 - build_esp_idf_tests
620 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
621 TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
622 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
623 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
624 ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
626 .test_template: &test_template
632 - /^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 <<: *unit_test_template
711 <<: *unit_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
922 <<: *unit_test_template
929 <<: *unit_test_template
936 <<: *unit_test_template
943 <<: *unit_test_template
950 <<: *unit_test_template
957 <<: *unit_test_template
964 <<: *unit_test_template
971 <<: *unit_test_template
978 <<: *unit_test_template
985 <<: *unit_test_template