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"
29 APPLY_BOT_FILTER_SCRIPT: "$CI_PROJECT_DIR/tools/ci/apply_bot_filter.py"
30 CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
32 # before each job, we need to check if this job is filtered by bot stage/job filter
33 .apply_bot_filter: &apply_bot_filter
34 python $APPLY_BOT_FILTER_SCRIPT || exit 0
37 # apply bot filter in before script
42 - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
43 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
44 - chmod 600 ~/.ssh/id_rsa
45 - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
47 # Set IS_PRIVATE or IS_PUBLIC depending on if our branch is public or not
49 # (the same regular expressions are used to set these are used in 'only:' sections below
50 - source tools/ci/configure_ci_environment.sh
52 # fetch the submodules (& if necessary re-fetch repo) from gitlab
53 - time ./tools/ci/get-full-sources.sh
56 before_script: &do_nothing_before
57 # apply bot filter in before script
59 - echo "Not setting up GitLab key, not fetching submodules"
60 - source tools/ci/configure_ci_environment.sh
62 .add_gitlab_key_before:
63 before_script: &add_gitlab_key_before
64 # apply bot filter in before script
66 - echo "Not fetching submodules"
67 - source tools/ci/configure_ci_environment.sh
71 - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
72 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
73 - chmod 600 ~/.ssh/id_rsa
74 - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
78 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
85 - git clone https://github.com/espressif/esp-idf-template.git
87 # Try to use the same branch name for esp-idf-template that we're
88 # using on esp-idf. If it doesn't exist then just stick to the default
90 - python $CHECKOUT_REF_SCRIPT esp-idf-template
91 # Test debug build (default)
93 # Now test release build
95 - sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
97 # Check if there are any stray printf/ets_printf references in WiFi libs
98 - cd ../components/esp32/lib
99 - test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
100 - test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0
103 .build_template: &build_template
105 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
119 - git clone $SSC_REPOSITORY
121 - python $CHECKOUT_REF_SCRIPT SSC
122 - MAKEFLAGS= ./gen_misc_ng.sh
128 - tools/unit-test-app/output
129 - components/idf_test/unit_test/TestCaseAll.yml
130 - components/idf_test/unit_test/CIConfigs/*.yml
133 - cd tools/unit-test-app
134 - make help # make sure kconfig tools are built in single process
135 - make ut-clean-all-configs
136 - export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
137 - export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
138 - make ut-build-all-configs TESTS_ALL=1
139 - python tools/UnitTestParser.py
141 .build_examples_template: &build_examples_template
146 - build_examples/*/*/*/build/*.bin
147 - build_examples/*/*/*/build/*.elf
148 - build_examples/*/*/*/build/*.map
149 - build_examples/*/*/*/build/download.config
150 - build_examples/*/*/*/build/bootloader/*.bin
155 LOG_PATH: "$CI_PROJECT_DIR/log_examples"
157 # it's not possible to build 100% out-of-tree and have the "artifacts"
158 # mechanism work, but this is the next best thing
159 - rm -rf build_examples
160 - mkdir build_examples
162 # build some of examples
163 - mkdir -p ${LOG_PATH}
164 - ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
167 <<: *build_examples_template
170 <<: *build_examples_template
173 <<: *build_examples_template
176 <<: *build_examples_template
179 <<: *build_examples_template
182 <<: *build_examples_template
185 <<: *build_examples_template
188 <<: *build_examples_template
193 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
199 - docs/doxygen-warning-log.txt
200 - docs/sphinx-warning-log.txt
201 - docs/sphinx-warning-log-sanitized.txt
207 # If there are Doxygen warnings, print them and bail out
208 - test $(cat doxygen-warning-log.txt | wc -l) -eq 0 || ( echo "Doxygen pass had some warnings:" && cat doxygen-warning-log.txt && false )
211 - ./check_doc_warnings.sh
215 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
220 - cd components/nvs_flash/test_nvs_host
223 test_partition_table_on_host:
225 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
230 - cd components/partition_table/test_gen_esp32part_host
231 - ./gen_esp32part_tests.py
235 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
240 - components/wear_levelling/test_wl_host/coverage_report.zip
243 - cd components/wear_levelling/test_wl_host
246 test_multi_heap_on_host:
248 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
252 - cd components/heap/test_multi_heap_host
257 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
262 - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
263 - rm -rf test_build_system
264 - mkdir test_build_system
265 - cd test_build_system
266 - ${IDF_PATH}/tools/ci/test_build_system.sh
270 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
277 - /^v\d+\.\d+(\.\d+)?($|-)/
279 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
280 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test"
281 REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report"
282 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/tools/unit-test-app/tools/ModuleDefinition.yml"
284 #We need all UT* and IT* artifacts except for only a few other
293 - VER_NUM=`git rev-list HEAD | wc -l | awk '{print $1}'`
294 - SHA_ID=`echo $CI_COMMIT_SHA | cut -c 1-7`
295 - REVISION="${VER_NUM}_${SHA_ID}"
296 # replace / to _ in branch name
297 - ESCAPED_BRANCH_NAME=`echo $CI_COMMIT_REF_NAME | sed 's/\//___/g'`
298 # result path and artifacts path
299 - RESULT_PATH="$CI_PROJECT_NAME/$ESCAPED_BRANCH_NAME/$REVISION"
300 - ARTIFACTS_PATH="$GITLAB_HTTP_SERVER/idf/esp-idf/builds/$CI_JOB_ID/artifacts/browse/$CI_COMMIT_SHA"
302 - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
303 - cd auto_test_script
304 - python $CHECKOUT_REF_SCRIPT auto_test_script
307 - 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
308 # commit to CI-test-result project
309 - git clone $GITLAB_SSH_SERVER/qa/CI-test-result.git
310 - rm -rf "CI-test-result/RawData/$RESULT_PATH"
311 - cp -R $CI_PROJECT_NAME CI-test-result/RawData
314 - git config --global user.email "ci-test-result@espressif.com"
315 - git config --global user.name "ci-test-result"
318 - git commit . -m "update test result for $CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA, pipeline ID $CI_PIPELINE_ID" || exit 0
319 - git push origin master
320 - test "${TEST_RESULT}" = "Pass" || exit 1
322 test_esp_err_to_name_on_host:
324 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
330 - ./gen_esp_err_to_name.py
331 - 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)
333 push_master_to_github:
335 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
341 - /^v\d+\.\d+(\.\d+)?($|-)/
345 GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
346 before_script: *do_nothing_before
350 - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
351 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
352 - chmod 600 ~/.ssh/id_rsa
353 - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
354 - git remote remove github &>/dev/null || true
355 - git remote add github git@github.com:espressif/esp-idf.git
356 # What the next line of script does: goes through the list of refs for all branches we push to github,
357 # generates a snippet of shell which is evaluated. The snippet checks CI_COMMIT_SHA against the SHA
358 # (aka objectname) at tip of each branch, and if any SHAs match then it checks out the local branch
359 # and then pushes that ref to a corresponding github branch
360 - 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)
365 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
371 - /^v\d+\.\d+(\.\d+)?($|-)/
375 before_script: *do_nothing_before
379 - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
380 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
381 - chmod 600 ~/.ssh/id_rsa
382 - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
383 - export GIT_VER=$(git describe --always)
386 - tar czvf $GIT_VER.tar.gz $GIT_VER
387 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH
388 - ssh $DOCS_SERVER -x "cd $DOCS_PATH && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
392 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
396 # can only be triggered
400 - docs/_build/linkcheck
403 # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
404 - test "$CHECK_LINKS" = "Yes" || exit 0
405 # can only run on master branch (otherwise the commit is not on Github yet)
406 - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
412 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
418 - /^v\d+\.\d+(\.\d+)?($|-)/
420 before_script: *do_nothing_before
423 - git log -n10 --oneline
424 # commit start with "WIP: " need to be squashed before merge
425 - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
427 check_submodule_sync:
429 image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
435 - /^v\d+\.\d+(\.\d+)?($|-)/
439 before_script: *do_nothing_before
441 # check if all submodules are correctly synced to public repostory
442 - git submodule update --init --recursive
447 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
448 # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
450 UT_BIN_PATH: "tools/unit-test-app/output"
451 OUTPUT_BIN_PATH: "test_bins/ESP32_IDF"
452 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
453 EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
457 - components/idf_test/*/CIConfigs
458 - components/idf_test/*/TC.sqlite
459 - $EXAMPLE_CONFIG_OUTPUT_PATH
460 - tools/unit-test-app/output
462 before_script: *add_gitlab_key_before
464 # first move test bins together: test_bins/CHIP_SDK/TestApp/bin_files
465 - mkdir -p $OUTPUT_BIN_PATH
466 - cp -r SSC/ssc_bin/* $OUTPUT_BIN_PATH
467 # assign example tests
468 - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
469 # assign unit test cases
470 - 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
471 # clone test script to assign tests
472 - git clone $TEST_SCRIPT_REPOSITORY
473 - cd auto_test_script
474 - python $CHECKOUT_REF_SCRIPT auto_test_script
475 # assgin integration test cases
476 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/test_bins
478 .example_test_template: &example_test_template
484 - /^v\d+\.\d+(\.\d+)?($|-)/
486 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
487 # we have a lot build example jobs and the binaries them exceed the limitation of artifacts.
488 # we can't artifact them in one job. For example test jobs, download all artifacts from previous stages.
495 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
496 TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
497 CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
498 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
500 # first test if config file exists, if not exist, exit 0
501 - test -e $CONFIG_FILE || exit 0
504 - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE
506 .unit_test_template: &unit_test_template
507 <<: *example_test_template
512 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
513 TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
514 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
515 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
517 .test_template: &test_template
523 - /^v\d+\.\d+(\.\d+)?($|-)/
534 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
535 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
536 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
537 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
538 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
539 before_script: *add_gitlab_key_before
541 # first test if config file exists, if not exist, exit 0
542 - test -e $CONFIG_FILE || exit 0
543 # clone local test env configs
544 - git clone $TEST_ENV_CONFIG_REPOSITORY
545 - cd ci-test-runner-configs
546 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
548 - git clone $TEST_SCRIPT_REPOSITORY
549 - cd auto_test_script
550 - python $CHECKOUT_REF_SCRIPT auto_test_script
552 - 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
566 # clone local test env configs
567 - git clone $TEST_ENV_CONFIG_REPOSITORY
568 - cd ci-test-runner-configs
569 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
571 - git clone $TEST_SCRIPT_REPOSITORY
572 - cd auto_test_script
573 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
575 - ./Tools/prepare_nvs_bin.sh
577 - 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
580 <<: *example_test_template
586 <<: *unit_test_template
593 <<: *unit_test_template
600 <<: *unit_test_template
607 <<: *unit_test_template
614 <<: *unit_test_template
621 <<: *unit_test_template
628 <<: *unit_test_template
635 <<: *unit_test_template
642 <<: *unit_test_template
649 <<: *unit_test_template
656 <<: *unit_test_template
663 <<: *unit_test_template
670 <<: *unit_test_template
677 <<: *unit_test_template
684 <<: *unit_test_template
691 <<: *unit_test_template
698 <<: *unit_test_template
705 <<: *unit_test_template
712 <<: *unit_test_template
719 <<: *unit_test_template
726 <<: *unit_test_template
733 <<: *unit_test_template
740 <<: *unit_test_template
747 <<: *unit_test_template
754 <<: *unit_test_template
761 <<: *unit_test_template
768 <<: *unit_test_template
775 <<: *unit_test_template
782 <<: *unit_test_template
789 <<: *unit_test_template
796 <<: *unit_test_template
803 <<: *unit_test_template
810 <<: *unit_test_template
817 <<: *unit_test_template
824 <<: *unit_test_template
831 <<: *unit_test_template