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
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
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
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
220 - cd components/nvs_flash/test_nvs_host
223 test_partition_table_on_host:
225 image: $CI_DOCKER_REGISTRY/esp32-ci-env
230 - cd components/partition_table/test_gen_esp32part_host
231 - ./gen_esp32part_tests.py
235 image: $CI_DOCKER_REGISTRY/esp32-ci-env
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
252 - cd components/heap/test_multi_heap_host
257 image: $CI_DOCKER_REGISTRY/esp32-ci-env
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
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 push_master_to_github:
324 image: $CI_DOCKER_REGISTRY/esp32-ci-env
330 - /^v\d+\.\d+(\.\d+)?($|-)/
334 GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
335 before_script: *do_nothing_before
339 - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
340 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
341 - chmod 600 ~/.ssh/id_rsa
342 - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
343 - git remote remove github &>/dev/null || true
344 - git remote add github git@github.com:espressif/esp-idf.git
345 # What the next line of script does: goes through the list of refs for all branches we push to github,
346 # generates a snippet of shell which is evaluated. The snippet checks CI_COMMIT_SHA against the SHA
347 # (aka objectname) at tip of each branch, and if any SHAs match then it checks out the local branch
348 # and then pushes that ref to a corresponding github branch
349 - 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)
354 image: $CI_DOCKER_REGISTRY/esp32-ci-env
360 - /^v\d+\.\d+(\.\d+)?($|-)/
364 before_script: *do_nothing_before
368 - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
369 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
370 - chmod 600 ~/.ssh/id_rsa
371 - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
372 - export GIT_VER=$(git describe --always)
375 - tar czvf $GIT_VER.tar.gz $GIT_VER
376 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH
377 - ssh $DOCS_SERVER -x "cd $DOCS_PATH && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
381 image: $CI_DOCKER_REGISTRY/esp32-ci-env
385 # can only be triggered
389 - docs/_build/linkcheck
392 # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
393 - test "$CHECK_LINKS" = "Yes" || exit 0
394 # can only run on master branch (otherwise the commit is not on Github yet)
395 - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
401 image: $CI_DOCKER_REGISTRY/esp32-ci-env
407 - /^v\d+\.\d+(\.\d+)?($|-)/
409 before_script: *do_nothing_before
412 - git log -n10 --oneline
413 # commit start with "WIP: " need to be squashed before merge
414 - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
416 check_submodule_sync:
418 image: $CI_DOCKER_REGISTRY/esp32-ci-env
424 - /^v\d+\.\d+(\.\d+)?($|-)/
428 before_script: *do_nothing_before
430 # check if all submodules are correctly synced to public repostory
431 - git submodule update --init --recursive
436 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
437 # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
439 UT_BIN_PATH: "tools/unit-test-app/output"
440 OUTPUT_BIN_PATH: "test_bins/ESP32_IDF"
441 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
442 EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
446 - components/idf_test/*/CIConfigs
447 - components/idf_test/*/TC.sqlite
448 - $EXAMPLE_CONFIG_OUTPUT_PATH
450 before_script: *add_gitlab_key_before
452 # first move test bins together: test_bins/CHIP_SDK/TestApp/bin_files
453 - mkdir -p $OUTPUT_BIN_PATH
454 # copy and rename folder name to "UT_config"
455 - for CONFIG in $(ls $UT_BIN_PATH); do cp -r "$UT_BIN_PATH/$CONFIG" "$OUTPUT_BIN_PATH/UT_$CONFIG"; done
456 - cp -r SSC/ssc_bin/* $OUTPUT_BIN_PATH
457 # assign example tests
458 - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
459 # clone test script to assign tests
460 - git clone $TEST_SCRIPT_REPOSITORY
461 - cd auto_test_script
462 - python $CHECKOUT_REF_SCRIPT auto_test_script
463 # assign unit test cases
464 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/unit_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/test_bins
465 # assgin integration test cases
466 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/test_bins
468 .example_test_template: &example_test_template
474 - /^v\d+\.\d+(\.\d+)?($|-)/
476 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
477 # we have a lot build example jobs and the binaries them exceed the limitation of artifacts.
478 # we can't artifact them in one job. For example test jobs, download all artifacts from previous stages.
485 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
486 TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
487 CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
488 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
490 # first test if config file exists, if not exist, exit 0
491 - test -e $CONFIG_FILE || exit 0
494 - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE
496 .test_template: &test_template
502 - /^v\d+\.\d+(\.\d+)?($|-)/
513 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
514 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
515 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
516 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
517 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
518 before_script: *add_gitlab_key_before
520 # first test if config file exists, if not exist, exit 0
521 - test -e $CONFIG_FILE || exit 0
522 # clone local test env configs
523 - git clone $TEST_ENV_CONFIG_REPOSITORY
524 - cd ci-test-runner-configs
525 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
527 - git clone $TEST_SCRIPT_REPOSITORY
528 - cd auto_test_script
529 - python $CHECKOUT_REF_SCRIPT auto_test_script
531 - 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
533 # template for unit test jobs
534 .unit_test_template: &unit_test_template
539 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
540 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
541 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/unit_test"
542 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
543 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
557 # clone local test env configs
558 - git clone $TEST_ENV_CONFIG_REPOSITORY
559 - cd ci-test-runner-configs
560 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
562 - git clone $TEST_SCRIPT_REPOSITORY
563 - cd auto_test_script
564 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
566 - ./Tools/prepare_nvs_bin.sh
568 - 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
571 <<: *example_test_template
577 <<: *unit_test_template
584 <<: *unit_test_template
591 <<: *unit_test_template
598 <<: *unit_test_template
605 <<: *unit_test_template
612 <<: *unit_test_template
619 <<: *unit_test_template
626 <<: *unit_test_template
633 <<: *unit_test_template
640 <<: *unit_test_template
647 <<: *unit_test_template
654 <<: *unit_test_template
661 <<: *unit_test_template
668 <<: *unit_test_template
675 <<: *unit_test_template
682 <<: *unit_test_template
689 <<: *unit_test_template
696 <<: *unit_test_template
703 <<: *unit_test_template
710 <<: *unit_test_template
717 <<: *unit_test_template
724 <<: *unit_test_template
731 <<: *unit_test_template
738 <<: *unit_test_template
745 <<: *unit_test_template
752 <<: *unit_test_template
759 <<: *unit_test_template
766 <<: *unit_test_template
773 <<: *unit_test_template
780 <<: *unit_test_template
787 <<: *unit_test_template
794 <<: *unit_test_template
801 <<: *unit_test_template
808 <<: *unit_test_template
815 <<: *unit_test_template
822 <<: *unit_test_template