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"
34 - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
35 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
36 - chmod 600 ~/.ssh/id_rsa
37 - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
39 # Set IS_PRIVATE or IS_PUBLIC depending on if our branch is public or not
41 # (the same regular expressions are used to set these are used in 'only:' sections below
42 - source tools/ci/configure_ci_environment.sh
44 # fetch the submodules (& if necessary re-fetch repo) from gitlab
45 - time ./tools/ci/get-full-sources.sh
48 before_script: &do_nothing_before
49 - echo "Not setting up GitLab key, not fetching submodules"
50 - source tools/ci/configure_ci_environment.sh
52 .add_gitlab_key_before:
53 before_script: &add_gitlab_key_before
54 - echo "Not fetching submodules"
55 - source tools/ci/configure_ci_environment.sh
59 - echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
60 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
61 - chmod 600 ~/.ssh/id_rsa
62 - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
66 image: $CI_DOCKER_REGISTRY/esp32-ci-env
73 - git clone https://github.com/espressif/esp-idf-template.git
75 # Try to use the same branch name for esp-idf-template that we're
76 # using on esp-idf. If it doesn't exist then just stick to the default
78 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using esp-idf-template default branch..."
79 # Test debug build (default)
81 # Now test release build
83 - sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
85 # Check if there are any stray printf/ets_printf references in WiFi libs
86 - cd ../components/esp32/lib
87 - test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
88 - test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0
91 .build_template: &build_template
93 image: $CI_DOCKER_REGISTRY/esp32-ci-env
107 - git clone $SSC_REPOSITORY
109 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using SSC default branch..."
110 - MAKEFLAGS= ./gen_misc_ng.sh
116 - tools/unit-test-app/output
117 - components/idf_test/unit_test/TestCaseAll.yml
118 - components/idf_test/unit_test/CIConfigs/*.yml
121 - cd tools/unit-test-app
122 - make help # make sure kconfig tools are built in single process
123 - make ut-clean-all-configs
124 - export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
125 - export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
126 - make ut-build-all-configs TESTS_ALL=1
127 - python tools/UnitTestParser.py
129 .build_examples_template: &build_examples_template
133 - build_examples/*/*/*/build/*.bin
134 - build_examples/*/*/*/build/*.elf
135 - build_examples/*/*/*/build/*.map
136 - build_examples/*/*/*/build/download.config
137 - build_examples/*/*/*/build/bootloader/*.bin
142 # it's not possible to build 100% out-of-tree and have the "artifacts"
143 # mechanism work, but this is the next best thing
144 - rm -rf build_examples
145 - mkdir build_examples
147 # build some of examples
148 - ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
151 <<: *build_examples_template
154 <<: *build_examples_template
157 <<: *build_examples_template
160 <<: *build_examples_template
163 <<: *build_examples_template
166 <<: *build_examples_template
169 <<: *build_examples_template
173 image: $CI_DOCKER_REGISTRY/esp32-ci-env
179 - docs/doxygen-warning-log.txt
180 - docs/sphinx-warning-log.txt
181 - docs/sphinx-warning-log-sanitized.txt
187 # If there are Doxygen warnings, print them and bail out
188 - test $(cat doxygen-warning-log.txt | wc -l) -eq 0 || ( echo "Doxygen pass had some warnings:" && cat doxygen-warning-log.txt && false )
191 - ./check_doc_warnings.sh
195 image: $CI_DOCKER_REGISTRY/esp32-ci-env
200 - cd components/nvs_flash/test_nvs_host
203 test_partition_table_on_host:
205 image: $CI_DOCKER_REGISTRY/esp32-ci-env
210 - cd components/partition_table/test_gen_esp32part_host
211 - ./gen_esp32part_tests.py
215 image: $CI_DOCKER_REGISTRY/esp32-ci-env
220 - components/wear_levelling/test_wl_host/coverage_report.zip
223 - cd components/wear_levelling/test_wl_host
226 test_multi_heap_on_host:
228 image: $CI_DOCKER_REGISTRY/esp32-ci-env
232 - cd components/heap/test_multi_heap_host
237 image: $CI_DOCKER_REGISTRY/esp32-ci-env
242 - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
243 - rm -rf test_build_system
244 - mkdir test_build_system
245 - cd test_build_system
246 - ${IDF_PATH}/tools/ci/test_build_system.sh
250 image: $CI_DOCKER_REGISTRY/esp32-ci-env
257 - /^v\d+\.\d+(\.\d+)?($|-)/
259 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
260 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test"
261 REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report"
262 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/tools/unit-test-app/tools/ModuleDefinition.yml"
264 #We need all UT* and IT* artifacts except for only a few other
273 - VER_NUM=`git rev-list HEAD | wc -l | awk '{print $1}'`
274 - SHA_ID=`echo $CI_COMMIT_SHA | cut -c 1-7`
275 - REVISION="${VER_NUM}_${SHA_ID}"
276 # replace / to _ in branch name
277 - ESCAPED_BRANCH_NAME=`echo $CI_COMMIT_REF_NAME | sed 's/\//___/g'`
278 # result path and artifacts path
279 - RESULT_PATH="$CI_PROJECT_NAME/$ESCAPED_BRANCH_NAME/$REVISION"
280 - ARTIFACTS_PATH="$GITLAB_HTTP_SERVER/idf/esp-idf/builds/$CI_JOB_ID/artifacts/browse/$CI_COMMIT_SHA"
282 - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
283 - cd auto_test_script
286 - 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
287 # commit to CI-test-result project
288 - git clone $GITLAB_SSH_SERVER/qa/CI-test-result.git
289 - rm -rf "CI-test-result/RawData/$RESULT_PATH"
290 - cp -R $CI_PROJECT_NAME CI-test-result/RawData
293 - git config --global user.email "ci-test-result@espressif.com"
294 - git config --global user.name "ci-test-result"
297 - git commit . -m "update test result for $CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA, pipeline ID $CI_PIPELINE_ID" || exit 0
298 - git push origin master
299 - test "${TEST_RESULT}" = "Pass" || exit 1
301 push_master_to_github:
303 image: $CI_DOCKER_REGISTRY/esp32-ci-env
309 - /^v\d+\.\d+(\.\d+)?($|-)/
313 GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
314 before_script: *do_nothing_before
318 - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
319 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
320 - chmod 600 ~/.ssh/id_rsa
321 - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
322 - git remote remove github &>/dev/null || true
323 - git remote add github git@github.com:espressif/esp-idf.git
324 # What the next line of script does: goes through the list of refs for all branches we push to github,
325 # generates a snippet of shell which is evaluated. The snippet checks CI_COMMIT_SHA against the SHA
326 # (aka objectname) at tip of each branch, and if any SHAs match then it checks out the local branch
327 # and then pushes that ref to a corresponding github branch
328 - 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)
333 image: $CI_DOCKER_REGISTRY/esp32-ci-env
339 - /^v\d+\.\d+(\.\d+)?($|-)/
343 before_script: *do_nothing_before
347 - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
348 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
349 - chmod 600 ~/.ssh/id_rsa
350 - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
351 - export GIT_VER=$(git describe --always)
354 - tar czvf $GIT_VER.tar.gz $GIT_VER
355 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH
356 - ssh $DOCS_SERVER -x "cd $DOCS_PATH && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
360 image: $CI_DOCKER_REGISTRY/esp32-ci-env
364 # can only be triggered
368 - docs/_build/linkcheck
371 # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
372 - test "$CHECK_LINKS" = "Yes" || exit 0
373 # can only run on master branch (otherwise the commit is not on Github yet)
374 - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
380 image: $CI_DOCKER_REGISTRY/esp32-ci-env
386 - /^v\d+\.\d+(\.\d+)?($|-)/
388 before_script: *do_nothing_before
391 - git log -n10 --oneline
392 # commit start with "WIP: " need to be squashed before merge
393 - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
395 check_submodule_sync:
397 image: $CI_DOCKER_REGISTRY/esp32-ci-env
403 - /^v\d+\.\d+(\.\d+)?($|-)/
407 before_script: *do_nothing_before
409 # check if all submodules are correctly synced to public repostory
410 - git submodule update --init --recursive
415 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
416 # we have a lot build example jobs. now we don't use dependencies, just download all artificats of build stage.
418 UT_BIN_PATH: "tools/unit-test-app/output"
419 OUTPUT_BIN_PATH: "test_bins/ESP32_IDF"
420 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
421 EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
425 - components/idf_test/*/CIConfigs
426 - components/idf_test/*/TC.sqlite
427 - $EXAMPLE_CONFIG_OUTPUT_PATH
429 before_script: *add_gitlab_key_before
431 # first move test bins together: test_bins/CHIP_SDK/TestApp/bin_files
432 - mkdir -p $OUTPUT_BIN_PATH
433 # copy and rename folder name to "UT_config"
434 - for CONFIG in $(ls $UT_BIN_PATH); do cp -r "$UT_BIN_PATH/$CONFIG" "$OUTPUT_BIN_PATH/UT_$CONFIG"; done
435 - cp -r SSC/ssc_bin/* $OUTPUT_BIN_PATH
436 # assign example tests
437 - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $IDF_PATH/.gitlab-ci.yml $EXAMPLE_CONFIG_OUTPUT_PATH
438 # clone test script to assign tests
439 - git clone $TEST_SCRIPT_REPOSITORY
440 - cd auto_test_script
441 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
442 # assign unit test cases
443 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/unit_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/test_bins
444 # assgin integration test cases
445 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/test_bins
447 .example_test_template: &example_test_template
453 - /^v\d+\.\d+(\.\d+)?($|-)/
455 # gitlab ci do not support match job with RegEx or wildcard now in dependencies.
456 # we have a lot build example jobs and the binaries them exceed the limitation of artifacts.
457 # we can't artifact them in one job. For example test jobs, download all artifacts from previous stages.
464 TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
465 TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
466 CONFIG_FILE: "$CI_PROJECT_DIR/examples/test_configs/$CI_JOB_NAME.yml"
467 LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
469 # first test if config file exists, if not exist, exit 0
470 - test -e $CONFIG_FILE || exit 0
473 - python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE
475 .test_template: &test_template
481 - /^v\d+\.\d+(\.\d+)?($|-)/
492 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
493 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
494 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
495 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
496 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
497 before_script: *add_gitlab_key_before
499 # first test if config file exists, if not exist, exit 0
500 - test -e $CONFIG_FILE || exit 0
501 # clone local test env configs
502 - git clone $TEST_ENV_CONFIG_REPOSITORY
504 - git clone $TEST_SCRIPT_REPOSITORY
505 - cd auto_test_script
506 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
508 - 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
510 # template for unit test jobs
511 .unit_test_template: &unit_test_template
516 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
517 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
518 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/unit_test"
519 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
520 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
534 # clone local test env configs
535 - git clone $TEST_ENV_CONFIG_REPOSITORY
537 - git clone $TEST_SCRIPT_REPOSITORY
538 - cd auto_test_script
539 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
541 - ./Tools/prepare_nvs_bin.sh
543 - 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
546 <<: *example_test_template
552 <<: *unit_test_template
559 <<: *unit_test_template
566 <<: *unit_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