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
145 - build_examples/*/*/*/build/*.bin
146 - build_examples/*/*/*/build/*.elf
147 - build_examples/*/*/*/build/*.map
148 - build_examples/*/*/*/build/download.config
149 - build_examples/*/*/*/build/bootloader/*.bin
154 # it's not possible to build 100% out-of-tree and have the "artifacts"
155 # mechanism work, but this is the next best thing
156 - rm -rf build_examples
157 - mkdir build_examples
159 # build some of examples
160 - ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
163 <<: *build_examples_template
166 <<: *build_examples_template
169 <<: *build_examples_template
172 <<: *build_examples_template
175 <<: *build_examples_template
178 <<: *build_examples_template
181 <<: *build_examples_template
184 <<: *build_examples_template
189 image: $CI_DOCKER_REGISTRY/esp32-ci-env
195 - docs/doxygen-warning-log.txt
196 - docs/sphinx-warning-log.txt
197 - docs/sphinx-warning-log-sanitized.txt
203 # If there are Doxygen warnings, print them and bail out
204 - test $(cat doxygen-warning-log.txt | wc -l) -eq 0 || ( echo "Doxygen pass had some warnings:" && cat doxygen-warning-log.txt && false )
207 - ./check_doc_warnings.sh
211 image: $CI_DOCKER_REGISTRY/esp32-ci-env
216 - cd components/nvs_flash/test_nvs_host
219 test_partition_table_on_host:
221 image: $CI_DOCKER_REGISTRY/esp32-ci-env
226 - cd components/partition_table/test_gen_esp32part_host
227 - ./gen_esp32part_tests.py
231 image: $CI_DOCKER_REGISTRY/esp32-ci-env
236 - components/wear_levelling/test_wl_host/coverage_report.zip
239 - cd components/wear_levelling/test_wl_host
242 test_multi_heap_on_host:
244 image: $CI_DOCKER_REGISTRY/esp32-ci-env
248 - cd components/heap/test_multi_heap_host
253 image: $CI_DOCKER_REGISTRY/esp32-ci-env
258 - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
259 - rm -rf test_build_system
260 - mkdir test_build_system
261 - cd test_build_system
262 - ${IDF_PATH}/tools/ci/test_build_system.sh
266 image: $CI_DOCKER_REGISTRY/esp32-ci-env
273 - /^v\d+\.\d+(\.\d+)?($|-)/
275 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
276 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test"
277 REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report"
278 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/tools/unit-test-app/tools/ModuleDefinition.yml"
280 #We need all UT* and IT* artifacts except for only a few other
289 - VER_NUM=`git rev-list HEAD | wc -l | awk '{print $1}'`
290 - SHA_ID=`echo $CI_COMMIT_SHA | cut -c 1-7`
291 - REVISION="${VER_NUM}_${SHA_ID}"
292 # replace / to _ in branch name
293 - ESCAPED_BRANCH_NAME=`echo $CI_COMMIT_REF_NAME | sed 's/\//___/g'`
294 # result path and artifacts path
295 - RESULT_PATH="$CI_PROJECT_NAME/$ESCAPED_BRANCH_NAME/$REVISION"
296 - ARTIFACTS_PATH="$GITLAB_HTTP_SERVER/idf/esp-idf/builds/$CI_JOB_ID/artifacts/browse/$CI_COMMIT_SHA"
298 - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
299 - cd auto_test_script
300 - python $CHECKOUT_REF_SCRIPT auto_test_script
303 - 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
304 # commit to CI-test-result project
305 - git clone $GITLAB_SSH_SERVER/qa/CI-test-result.git
306 - rm -rf "CI-test-result/RawData/$RESULT_PATH"
307 - cp -R $CI_PROJECT_NAME CI-test-result/RawData
310 - git config --global user.email "ci-test-result@espressif.com"
311 - git config --global user.name "ci-test-result"
314 - git commit . -m "update test result for $CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA, pipeline ID $CI_PIPELINE_ID" || exit 0
315 - git push origin master
316 - test "${TEST_RESULT}" = "Pass" || exit 1
318 push_master_to_github:
320 image: $CI_DOCKER_REGISTRY/esp32-ci-env
326 - /^v\d+\.\d+(\.\d+)?($|-)/
330 GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
331 before_script: *do_nothing_before
335 - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
336 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
337 - chmod 600 ~/.ssh/id_rsa
338 - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
339 - git remote remove github &>/dev/null || true
340 - git remote add github git@github.com:espressif/esp-idf.git
341 # What the next line of script does: goes through the list of refs for all branches we push to github,
342 # generates a snippet of shell which is evaluated. The snippet checks CI_COMMIT_SHA against the SHA
343 # (aka objectname) at tip of each branch, and if any SHAs match then it checks out the local branch
344 # and then pushes that ref to a corresponding github branch
345 - 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)
350 image: $CI_DOCKER_REGISTRY/esp32-ci-env
356 - /^v\d+\.\d+(\.\d+)?($|-)/
360 before_script: *do_nothing_before
364 - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
365 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
366 - chmod 600 ~/.ssh/id_rsa
367 - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
368 - export GIT_VER=$(git describe --always)
371 - tar czvf $GIT_VER.tar.gz $GIT_VER
372 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH
373 - ssh $DOCS_SERVER -x "cd $DOCS_PATH && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
377 image: $CI_DOCKER_REGISTRY/esp32-ci-env
381 # can only be triggered
385 - docs/_build/linkcheck
388 # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
389 - test "$CHECK_LINKS" = "Yes" || exit 0
390 # can only run on master branch (otherwise the commit is not on Github yet)
391 - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
397 image: $CI_DOCKER_REGISTRY/esp32-ci-env
403 - /^v\d+\.\d+(\.\d+)?($|-)/
405 before_script: *do_nothing_before
408 - git log -n10 --oneline
409 # commit start with "WIP: " need to be squashed before merge
410 - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
412 check_submodule_sync:
414 image: $CI_DOCKER_REGISTRY/esp32-ci-env
420 - /^v\d+\.\d+(\.\d+)?($|-)/
424 before_script: *do_nothing_before
426 # check if all submodules are correctly synced to public repostory
427 - git submodule update --init --recursive
432 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
433 # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
435 UT_BIN_PATH: "tools/unit-test-app/output"
436 OUTPUT_BIN_PATH: "test_bins/ESP32_IDF"
437 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
438 EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
442 - components/idf_test/*/CIConfigs
443 - components/idf_test/*/TC.sqlite
444 - $EXAMPLE_CONFIG_OUTPUT_PATH
446 before_script: *add_gitlab_key_before
448 # first move test bins together: test_bins/CHIP_SDK/TestApp/bin_files
449 - mkdir -p $OUTPUT_BIN_PATH
450 # copy and rename folder name to "UT_config"
451 - for CONFIG in $(ls $UT_BIN_PATH); do cp -r "$UT_BIN_PATH/$CONFIG" "$OUTPUT_BIN_PATH/UT_$CONFIG"; done
452 - cp -r SSC/ssc_bin/* $OUTPUT_BIN_PATH
453 # assign example tests
454 - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
455 # clone test script to assign tests
456 - git clone $TEST_SCRIPT_REPOSITORY
457 - cd auto_test_script
458 - python $CHECKOUT_REF_SCRIPT auto_test_script
459 # assign unit test cases
460 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/unit_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/test_bins
461 # assgin integration test cases
462 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/test_bins
464 .example_test_template: &example_test_template
470 - /^v\d+\.\d+(\.\d+)?($|-)/
472 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
473 # we have a lot build example jobs and the binaries them exceed the limitation of artifacts.
474 # we can't artifact them in one job. For example test jobs, download all artifacts from previous stages.
481 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
482 TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
483 CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
484 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
486 # first test if config file exists, if not exist, exit 0
487 - test -e $CONFIG_FILE || exit 0
490 - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE
492 .test_template: &test_template
498 - /^v\d+\.\d+(\.\d+)?($|-)/
509 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
510 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
511 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
512 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
513 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
514 before_script: *add_gitlab_key_before
516 # first test if config file exists, if not exist, exit 0
517 - test -e $CONFIG_FILE || exit 0
518 # clone local test env configs
519 - git clone $TEST_ENV_CONFIG_REPOSITORY
520 - cd ci-test-runner-configs
521 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
523 - git clone $TEST_SCRIPT_REPOSITORY
524 - cd auto_test_script
525 - python $CHECKOUT_REF_SCRIPT auto_test_script
527 - 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
529 # template for unit test jobs
530 .unit_test_template: &unit_test_template
535 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
536 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
537 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/unit_test"
538 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
539 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
553 # clone local test env configs
554 - git clone $TEST_ENV_CONFIG_REPOSITORY
555 - cd ci-test-runner-configs
556 - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
558 - git clone $TEST_SCRIPT_REPOSITORY
559 - cd auto_test_script
560 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
562 - ./Tools/prepare_nvs_bin.sh
564 - 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
567 <<: *example_test_template
573 <<: *unit_test_template
580 <<: *unit_test_template
587 <<: *unit_test_template
594 <<: *unit_test_template
601 <<: *unit_test_template
608 <<: *unit_test_template
615 <<: *unit_test_template
622 <<: *unit_test_template
629 <<: *unit_test_template
636 <<: *unit_test_template
643 <<: *unit_test_template
650 <<: *unit_test_template
657 <<: *unit_test_template
664 <<: *unit_test_template
671 <<: *unit_test_template
678 <<: *unit_test_template
685 <<: *unit_test_template
692 <<: *unit_test_template
699 <<: *unit_test_template
706 <<: *unit_test_template
713 <<: *unit_test_template
720 <<: *unit_test_template
727 <<: *unit_test_template
734 <<: *unit_test_template
741 <<: *unit_test_template
748 <<: *unit_test_template
755 <<: *unit_test_template
762 <<: *unit_test_template
769 <<: *unit_test_template
776 <<: *unit_test_template
783 <<: *unit_test_template
790 <<: *unit_test_template
797 <<: *unit_test_template
804 <<: *unit_test_template
811 <<: *unit_test_template