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 # before each job, we need to check if this job is filtered by bot stage/job filter
35 .apply_bot_filter: &apply_bot_filter
36 python $APPLY_BOT_FILTER_SCRIPT || exit 0
39 # apply bot filter in before script
44 - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
45 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
46 - chmod 600 ~/.ssh/id_rsa
47 - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
49 # Set IS_PRIVATE or IS_PUBLIC depending on if our branch is public or not
51 # (the same regular expressions are used to set these are used in 'only:' sections below
52 - source tools/ci/configure_ci_environment.sh
54 # fetch the submodules (& if necessary re-fetch repo) from gitlab
55 - time ./tools/ci/get-full-sources.sh
58 before_script: &do_nothing_before
59 # apply bot filter in before script
61 - echo "Not setting up GitLab key, not fetching submodules"
62 - source tools/ci/configure_ci_environment.sh
64 .add_gitlab_key_before:
65 before_script: &add_gitlab_key_before
66 # apply bot filter in before script
68 - echo "Not fetching submodules"
69 - source tools/ci/configure_ci_environment.sh
73 - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
74 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
75 - chmod 600 ~/.ssh/id_rsa
76 - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
80 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
87 - git clone https://github.com/espressif/esp-idf-template.git
89 # Try to use the same branch name for esp-idf-template that we're
90 # using on esp-idf. If it doesn't exist then just stick to the default
92 - python $CHECKOUT_REF_SCRIPT esp-idf-template
93 # Test debug build (default)
95 # Now test release build
97 - sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
99 # Check if there are any stray printf/ets_printf references in WiFi libs
100 - cd ../components/esp32/lib
101 - test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
102 - test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0
105 .build_template: &build_template
107 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
114 .build_ssc_template: &build_ssc_template
121 SSC_CONFIG_FOLDER: "$CI_PROJECT_DIR/SSC/configs/ESP32_IDF"
123 - git clone $SSC_REPOSITORY
125 - python $CHECKOUT_REF_SCRIPT SSC
126 - MAKEFLAGS= ./ci_build_ssc.sh "${CI_JOB_NAME}" "${IDF_PATH}/.gitlab-ci.yml"
128 # don't forget to add to dependency to test_template when adding new build_ssc jobs
130 <<: *build_ssc_template
133 <<: *build_ssc_template
136 <<: *build_ssc_template
142 - tools/unit-test-app/output
143 - components/idf_test/unit_test/TestCaseAll.yml
144 - components/idf_test/unit_test/CIConfigs/*.yml
147 - cd tools/unit-test-app
148 - make help # make sure kconfig tools are built in single process
149 - make ut-clean-all-configs
150 - export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
151 - export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
152 - make ut-build-all-configs TESTS_ALL=1
153 - python tools/UnitTestParser.py
155 .build_examples_template: &build_examples_template
160 - build_examples/*/*/*/build/*.bin
161 - build_examples/*/*/*/build/*.elf
162 - build_examples/*/*/*/build/*.map
163 - build_examples/*/*/*/build/download.config
164 - build_examples/*/*/*/build/bootloader/*.bin
169 LOG_PATH: "$CI_PROJECT_DIR/log_examples"
171 # it's not possible to build 100% out-of-tree and have the "artifacts"
172 # mechanism work, but this is the next best thing
173 - rm -rf build_examples
174 - mkdir build_examples
176 # build some of examples
177 - mkdir -p ${LOG_PATH}
178 - ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
181 <<: *build_examples_template
184 <<: *build_examples_template
187 <<: *build_examples_template
190 <<: *build_examples_template
193 <<: *build_examples_template
196 <<: *build_examples_template
199 <<: *build_examples_template
202 <<: *build_examples_template
207 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
213 # English version of documentation
214 - docs/en/doxygen-warning-log.txt
215 - docs/en/sphinx-warning-log.txt
216 - docs/en/sphinx-warning-log-sanitized.txt
217 - docs/en/_build/html
218 # Chinese version of documentation
219 - docs/zh_CN/doxygen-warning-log.txt
220 - docs/zh_CN/sphinx-warning-log.txt
221 - docs/zh_CN/sphinx-warning-log-sanitized.txt
222 - docs/zh_CN/_build/html
226 - ./check_lang_folder_sync.sh
230 - ../check_doc_warnings.sh
234 - ../check_doc_warnings.sh
238 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
243 - cd components/nvs_flash/test_nvs_host
248 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
254 - components/nvs_flash/test_nvs_host/coverage_report
257 # This job takes a few hours to finish, so only run it on demand
259 BOT_NEEDS_TRIGGER_BY_NAME: 1
261 - cd components/nvs_flash/test_nvs_host
262 - make coverage_report
264 test_partition_table_on_host:
266 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
271 - cd components/partition_table/test_gen_esp32part_host
272 - ./gen_esp32part_tests.py
276 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
281 - components/wear_levelling/test_wl_host/coverage_report.zip
284 - cd components/wear_levelling/test_wl_host
287 test_multi_heap_on_host:
289 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
293 - cd components/heap/test_multi_heap_host
294 - ./test_all_configs.sh
298 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
303 - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
304 - rm -rf test_build_system
305 - mkdir test_build_system
306 - cd test_build_system
307 - ${IDF_PATH}/tools/ci/test_build_system.sh
311 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
319 - /^v\d+\.\d+(\.\d+)?($|-)/
321 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
322 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test"
323 REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report"
324 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/tools/unit-test-app/tools/ModuleDefinition.yml"
326 #We need all UT* and IT* artifacts except for only a few other
335 - VER_NUM=`git rev-list HEAD | wc -l | awk '{print $1}'`
336 - SHA_ID=`echo $CI_COMMIT_SHA | cut -c 1-7`
337 - REVISION="${VER_NUM}_${SHA_ID}"
338 # replace / to _ in branch name
339 - ESCAPED_BRANCH_NAME=`echo $CI_COMMIT_REF_NAME | sed 's/\//___/g'`
340 # result path and artifacts path
341 - RESULT_PATH="$CI_PROJECT_NAME/$ESCAPED_BRANCH_NAME/$REVISION"
342 - ARTIFACTS_PATH="$GITLAB_HTTP_SERVER/idf/esp-idf/builds/$CI_JOB_ID/artifacts/browse/$CI_COMMIT_SHA"
344 - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
345 - cd auto_test_script
346 - python $CHECKOUT_REF_SCRIPT auto_test_script
349 - 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
350 # commit to CI-test-result project
351 - git clone $GITLAB_SSH_SERVER/qa/CI-test-result.git
352 - rm -rf "CI-test-result/RawData/$RESULT_PATH"
353 - cp -R $CI_PROJECT_NAME CI-test-result/RawData
356 - git config --global user.email "ci-test-result@espressif.com"
357 - git config --global user.name "ci-test-result"
360 - git commit . -m "update test result for $CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA, pipeline ID $CI_PIPELINE_ID" || exit 0
361 - git push origin master
362 - test "${TEST_RESULT}" = "Pass" || exit 1
364 test_esp_err_to_name_on_host:
366 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
372 - ./gen_esp_err_to_name.py
373 - 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)
375 push_master_to_github:
377 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
383 - /^v\d+\.\d+(\.\d+)?($|-)/
387 GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
388 before_script: *do_nothing_before
392 - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
393 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
394 - chmod 600 ~/.ssh/id_rsa
395 - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
396 - git remote remove github &>/dev/null || true
397 - git remote add github git@github.com:espressif/esp-idf.git
398 # What the next line of script does: goes through the list of refs for all branches we push to github,
399 # generates a snippet of shell which is evaluated. The snippet checks CI_COMMIT_SHA against the SHA
400 # (aka objectname) at tip of each branch, and if any SHAs match then it checks out the local branch
401 # and then pushes that ref to a corresponding github branch
402 - 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)
407 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
413 - /^v\d+\.\d+(\.\d+)?($|-)/
417 before_script: *do_nothing_before
421 - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
422 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
423 - chmod 600 ~/.ssh/id_rsa
424 - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
425 - export GIT_VER=$(git describe --always)
428 - tar czvf $GIT_VER.tar.gz $GIT_VER
429 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/en
430 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/en && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
431 - cd ../../zh_CN/_build/
433 - tar czvf $GIT_VER.tar.gz $GIT_VER
434 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/zh_CN
435 - ssh $DOCS_SERVER -x "cd $DOCS_PATH/zh_CN && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
436 # add link to preview doc
437 - echo "[document preview][en] $CI_DOCKER_REGISTRY/docs/esp-idf/en/${GIT_VER}/index.html"
438 - echo "[document preview][zh_CN] $CI_DOCKER_REGISTRY/docs/esp-idf/zh_CN/${GIT_VER}/index.html"
442 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
446 # can only be triggered
450 - docs/_build/linkcheck
453 # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
454 - test "$CHECK_LINKS" = "Yes" || exit 0
455 # can only run on master branch (otherwise the commit is not on Github yet)
456 - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
462 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
468 - /^v\d+\.\d+(\.\d+)?($|-)/
470 before_script: *do_nothing_before
473 - git log -n10 --oneline
474 # commit start with "WIP: " need to be squashed before merge
475 - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
477 check_submodule_sync:
479 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
485 - /^v\d+\.\d+(\.\d+)?($|-)/
489 before_script: *do_nothing_before
491 # check if all submodules are correctly synced to public repostory
492 - git submodule update --init --recursive
497 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
498 # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
500 UT_BIN_PATH: "tools/unit-test-app/output"
501 OUTPUT_BIN_PATH: "test_bins/ESP32_IDF"
502 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
503 EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
507 - components/idf_test/*/CIConfigs
508 - components/idf_test/*/TC.sqlite
509 - $EXAMPLE_CONFIG_OUTPUT_PATH
510 - tools/unit-test-app/output
512 before_script: *add_gitlab_key_before
514 # first move test bins together: test_bins/CHIP_SDK/TestApp/bin_files
515 - mkdir -p $OUTPUT_BIN_PATH
516 - cp -r SSC/ssc_bin/* $OUTPUT_BIN_PATH
517 # assign example tests
518 - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
519 # assign unit test cases
520 - 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
521 # clone test script to assign tests
522 - git clone $TEST_SCRIPT_REPOSITORY
523 - cd auto_test_script
524 - python $CHECKOUT_REF_SCRIPT auto_test_script
525 # assgin integration test cases
526 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
528 .example_test_template: &example_test_template
534 - /^v\d+\.\d+(\.\d+)?($|-)/
537 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
538 # we have a lot build example jobs and the binaries them exceed the limitation of artifacts.
539 # we can't artifact them in one job. For example test jobs, download all artifacts from previous stages.
546 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
547 TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
548 CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
549 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
551 # first test if config file exists, if not exist, exit 0
552 - test -e $CONFIG_FILE || exit 0
555 - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE
557 .unit_test_template: &unit_test_template
558 <<: *example_test_template
563 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
564 TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
565 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
566 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
568 .test_template: &test_template
574 - /^v\d+\.\d+(\.\d+)?($|-)/
589 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
590 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
591 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
592 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
593 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
594 before_script: *add_gitlab_key_before
596 # first test if config file exists, if not exist, exit 0
597 - test -e $CONFIG_FILE || exit 0
598 # clone local test env configs
599 - git clone $TEST_ENV_CONFIG_REPOSITORY
600 - cd ci-test-runner-configs
601 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
603 - git clone $TEST_SCRIPT_REPOSITORY
604 - cd auto_test_script
605 - python $CHECKOUT_REF_SCRIPT auto_test_script
607 - 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
621 # clone local test env configs
622 - git clone $TEST_ENV_CONFIG_REPOSITORY
623 - cd ci-test-runner-configs
624 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
626 - git clone $TEST_SCRIPT_REPOSITORY
627 - cd auto_test_script
628 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
630 - ./Tools/prepare_nvs_bin.sh
632 - 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
635 <<: *example_test_template
641 <<: *unit_test_template
648 <<: *unit_test_template
655 <<: *unit_test_template
662 <<: *unit_test_template
669 <<: *unit_test_template
676 <<: *unit_test_template
683 <<: *unit_test_template
690 <<: *unit_test_template
697 <<: *unit_test_template
704 <<: *unit_test_template
711 <<: *unit_test_template
718 <<: *unit_test_template
725 <<: *unit_test_template
732 <<: *unit_test_template
739 <<: *unit_test_template
746 <<: *unit_test_template
753 <<: *unit_test_template
760 <<: *unit_test_template
767 <<: *unit_test_template
774 <<: *unit_test_template
781 <<: *unit_test_template
788 <<: *unit_test_template
795 <<: *unit_test_template
802 <<: *unit_test_template
809 <<: *unit_test_template
816 <<: *unit_test_template
823 <<: *unit_test_template
830 <<: *unit_test_template
837 <<: *unit_test_template
844 <<: *unit_test_template
851 <<: *unit_test_template
858 <<: *unit_test_template
865 <<: *unit_test_template
872 <<: *unit_test_template
879 <<: *unit_test_template
886 <<: *unit_test_template