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
115 - git clone $GITLAB_SSH_SERVER/application/esp-at.git
117 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using esp-at default branch..."
125 - tools/unit-test-app/build/*.bin
126 - tools/unit-test-app/build/*.elf
127 - tools/unit-test-app/build/*.map
128 - tools/unit-test-app/build/download.config
129 - tools/unit-test-app/build/bootloader/*.bin
130 - components/idf_test/unit_test/TestCaseAll.yml
131 - components/idf_test/unit_test/CIConfigs/*.yml
134 - cd tools/unit-test-app
136 # cut last line in case make V=0/1 is set by default
137 - make print_flash_cmd | tail -n 1 > build/download.config
138 - python tools/UnitTestParser.py
140 .build_examples_template: &build_examples_template
144 - build_examples/*/*/*/build/*.bin
145 - build_examples/*/*/*/build/*.elf
146 - build_examples/*/*/*/build/*.map
147 - build_examples/*/*/*/build/bootloader/*.bin
152 # it's not possible to build 100% out-of-tree and have the "artifacts"
153 # mechanism work, but this is the next best thing
154 - mkdir build_examples
156 # build some of examples
157 - ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
160 <<: *build_examples_template
163 <<: *build_examples_template
166 <<: *build_examples_template
169 <<: *build_examples_template
172 <<: *build_examples_template
176 image: $CI_DOCKER_REGISTRY/esp32-ci-env
186 # If not building master branch, and there are Doxygen warnings, print them and bail out
187 - test -n $IS_PRIVATE && test $(cat doxygen-warning-log.txt | wc -l) -eq 0 || ( echo "Doxygen pass had some warnings:" && cat doxygen-warning-log.txt && false )
193 image: $CI_DOCKER_REGISTRY/esp32-ci-env
198 - cd components/nvs_flash/test_nvs_host
201 test_partition_table_on_host:
203 image: $CI_DOCKER_REGISTRY/esp32-ci-env
208 - cd components/partition_table/test_gen_esp32part_host
209 - ./gen_esp32part_tests.py
213 image: $CI_DOCKER_REGISTRY/esp32-ci-env
218 - components/wear_levelling/test_wl_host/coverage_report.zip
221 - cd components/wear_levelling/test_wl_host
224 test_multi_heap_on_host:
226 image: $CI_DOCKER_REGISTRY/esp32-ci-env
230 - cd components/heap/test_multi_heap_host
235 image: $CI_DOCKER_REGISTRY/esp32-ci-env
240 - ./tools/ci/test_configure_ci_environment.sh
241 - ./tools/ci/test_build_system.sh
245 image: $CI_DOCKER_REGISTRY/esp32-ci-env
252 - /^v\d+\.\d+(\.\d+)?($|-)/
254 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
255 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test"
256 REPORT_PATH: "$CI_PROJECT_DIR/CI_Test_Report"
257 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/tools/unit-test-app/tools/ModuleDefinition.yml"
259 #We need all UT* and IT* artifacts except for only a few other
268 - VER_NUM=`git rev-list HEAD | wc -l | awk '{print $1}'`
269 - SHA_ID=`echo $CI_COMMIT_SHA | cut -c 1-7`
270 - REVISION="${VER_NUM}_${SHA_ID}"
271 # replace / to _ in branch name
272 - ESCAPED_BRANCH_NAME=`echo $CI_COMMIT_REF_NAME | sed 's/\//___/g'`
273 # result path and artifacts path
274 - RESULT_PATH="$CI_PROJECT_NAME/$ESCAPED_BRANCH_NAME/$REVISION"
275 - ARTIFACTS_PATH="$GITLAB_HTTP_SERVER/idf/esp-idf/builds/$CI_JOB_ID/artifacts/browse/$CI_COMMIT_SHA"
277 - git clone $GITLAB_SSH_SERVER/yinling/auto_test_script.git
278 - cd auto_test_script
281 - 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
282 # commit to CI-test-result project
283 - git clone $GITLAB_SSH_SERVER/qa/CI-test-result.git
284 - rm -rf "CI-test-result/RawData/$RESULT_PATH"
285 - cp -R $CI_PROJECT_NAME CI-test-result/RawData
288 - git config --global user.email "ci-test-result@espressif.com"
289 - git config --global user.name "ci-test-result"
292 - git commit . -m "update test result for $CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA, pipeline ID $CI_PIPELINE_ID" || exit 0
293 - git push origin master
294 - test "${TEST_RESULT}" = "Pass" || exit 1
296 push_master_to_github:
298 image: $CI_DOCKER_REGISTRY/esp32-ci-env
304 - /^v\d+\.\d+(\.\d+)?($|-)/
308 GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
309 before_script: *do_nothing_before
313 - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
314 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
315 - chmod 600 ~/.ssh/id_rsa
316 - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
317 - git remote remove github &>/dev/null || true
318 - git remote add github git@github.com:espressif/esp-idf.git
319 # What the next line of script does: goes through the list of refs for all branches we push to github,
320 # generates a snippet of shell which is evaluated. The snippet checks CI_COMMIT_SHA against the SHA
321 # (aka objectname) at tip of each branch, and if any SHAs match then it checks out the local branch
322 # and then pushes that ref to a corresponding github branch
323 - 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)
328 image: $CI_DOCKER_REGISTRY/esp32-ci-env
334 - /^v\d+\.\d+(\.\d+)?($|-)/
338 before_script: *do_nothing_before
342 - echo -n $DOCS_DEPLOY_KEY > ~/.ssh/id_rsa_base64
343 - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
344 - chmod 600 ~/.ssh/id_rsa
345 - echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
346 - export GIT_VER=$(git describe --always)
349 - tar czvf $GIT_VER.tar.gz $GIT_VER
350 - scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH
351 - ssh $DOCS_SERVER -x "cd $DOCS_PATH && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
355 image: $CI_DOCKER_REGISTRY/esp32-ci-env
359 # can only be triggered
363 - docs/_build/linkcheck
366 # must be triggered with CHECK_LINKS=Yes, otherwise exit without test
367 - test "$CHECK_LINKS" = "Yes" || exit 0
368 # can only run on master branch (otherwise the commit is not on Github yet)
369 - test "${CI_COMMIT_REF_NAME}" = "master" || exit 0
375 image: $CI_DOCKER_REGISTRY/esp32-ci-env
381 - /^v\d+\.\d+(\.\d+)?($|-)/
383 before_script: *do_nothing_before
386 - git log -n10 --oneline
387 # commit start with "WIP: " need to be squashed before merge
388 - 'git log --pretty=%s master.. -- | grep "^WIP: " && exit 1 || exit 0'
390 check_submodule_sync:
392 image: $CI_DOCKER_REGISTRY/esp32-ci-env
398 - /^v\d+\.\d+(\.\d+)?($|-)/
402 before_script: *do_nothing_before
404 # check if all submodules are correctly synced to public repostory
405 - git submodule update --init --recursive
411 - build_esp_idf_tests
416 - components/idf_test/*/CIConfigs
417 - components/idf_test/*/TC.sqlite
419 before_script: *add_gitlab_key_before
421 # first move test bins together: test_bins/CHIP_SDK/TestApp/bin_files
422 - mkdir -p test_bins/ESP32_IDF/UT
423 - cp -r tools/unit-test-app/build/* test_bins/ESP32_IDF/UT
424 - cp -r SSC/ssc_bin/* test_bins/ESP32_IDF
425 # clone test script to assign tests
426 - git clone $TEST_SCRIPT_REPOSITORY
427 - cd auto_test_script
428 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
429 # assign unit test cases
430 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/unit_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/test_bins
431 # assgin integration test cases
432 - python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/test_bins
434 .test_template: &test_template
440 - /^v\d+\.\d+(\.\d+)?($|-)/
451 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
452 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
453 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
454 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
455 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/integration_test/CIConfigs/$CI_JOB_NAME.yml"
456 before_script: *add_gitlab_key_before
458 # first test if config file exists, if not exist, exit 0
459 - test -e $CONFIG_FILE || exit 0
460 # clone local test env configs
461 - git clone $TEST_ENV_CONFIG_REPOSITORY
463 - git clone $TEST_SCRIPT_REPOSITORY
464 - cd auto_test_script
465 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
467 - 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
469 # template for unit test jobs
470 .unit_test_template: &unit_test_template
475 LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
476 LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
477 TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/unit_test"
478 MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
479 CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
493 # clone local test env configs
494 - git clone $TEST_ENV_CONFIG_REPOSITORY
496 - git clone $TEST_SCRIPT_REPOSITORY
497 - cd auto_test_script
498 - git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
500 - ./Tools/prepare_nvs_bin.sh
502 - 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
505 <<: *unit_test_template
511 <<: *unit_test_template
517 <<: *unit_test_template
523 <<: *unit_test_template