esp-idf/tools/ci/config/build.yml

503 lines
16 KiB
YAML
Raw Normal View History

.build_template:
stage: build
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
tags:
- build
variables:
2020-07-21 04:00:05 -04:00
SIZE_INFO_LOCATION: "$CI_PROJECT_DIR/size_info.txt"
dependencies: []
.build_template_app_template:
extends:
- .build_template
- .rules:labels:build
variables:
LOG_PATH: "${CI_PROJECT_DIR}/log_template_app"
BUILD_PATH: "${CI_PROJECT_DIR}/build_template_app"
BUILD_DIR: "@t/@w"
BUILD_LOG_MAKE: "${LOG_PATH}/make_@t_@w.txt"
BUILD_LOG_CMAKE: "${LOG_PATH}/cmake_@t_@w.txt"
BUILD_COMMAND_ARGS: ""
artifacts:
when: always
paths:
- log_template_app/*
- size_info.txt
- build_template_app/**/size.json
script:
# Set the variable for 'esp-idf-template' testing
- ESP_IDF_TEMPLATE_GIT=${ESP_IDF_TEMPLATE_GIT:-"https://github.com/espressif/esp-idf-template.git"}
- retry_failed git clone ${ESP_IDF_TEMPLATE_GIT}
# Try to use the same branch name for esp-idf-template that we're
# using on esp-idf. If it doesn't exist then just stick to the default branch
- python $CHECKOUT_REF_SCRIPT esp-idf-template esp-idf-template
- export PATH="$IDF_PATH/tools:$PATH"
- export EXTRA_CFLAGS=${PEDANTIC_CFLAGS}
- export EXTRA_CXXFLAGS=${PEDANTIC_CXXFLAGS}
# Only do the default cmake build for each target, remaining part are done in the build_template_app job
- tools/ci/build_template_app.sh ${BUILD_COMMAND_ARGS}
# Check if there are any stray printf/ets_printf references in WiFi libs
- cd components/esp_wifi/lib
- for dir in esp32 esp32s2; do test $(xtensa-esp32-elf-nm $dir/*.a | grep -w printf | wc -l) -eq 0; done;
- for dir in esp32 esp32s2; do test $(xtensa-esp32-elf-nm $dir/*.a | grep -w ets_printf | wc -l) -eq 0; done;
# build-related-pre-check-jobs ------------------------------------------------
# Build at least one project for each target at earliest stage to reduce build cost for obvious failing commits
fast_template_app:
extends:
- .build_template_app_template
- .rules:build_tests:target_test-weekend_test
stage: pre_check
variables:
BUILD_COMMAND_ARGS: "-p"
check_docs_gh_links:
extends: .build_docs_template
stage: pre_check
variables:
SUBMODULES_TO_FETCH: "none"
script:
- cd docs
- ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 3.6.10 pip install -r requirements.txt
- ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 3.6.10 ./build_docs.py gh-linkcheck
#------------------------------------------------------------------------------
.build_ssc_template:
extends:
- .build_template
- .rules:build_tests:integration_test
artifacts:
paths:
- SSC/ssc_bin
expire_in: 1 week
script:
- retry_failed git clone $SSC_REPOSITORY
- python $CHECKOUT_REF_SCRIPT SSC SSC
- cd SSC
- MAKEFLAGS= ./ci_build_ssc.sh $TARGET_NAME
build_ssc_esp32:
extends: .build_ssc_template
parallel: 3
variables:
TARGET_NAME: "ESP32"
2020-01-16 22:47:08 -05:00
build_ssc_esp32s2:
extends: .build_ssc_template
parallel: 2
variables:
TARGET_NAME: "ESP32S2"
.build_esp_idf_tests_cmake:
extends:
- .build_template
- .rules:build_tests:unit_test
dependencies: # set dependencies to null to avoid missing artifacts issue
needs:
- job: fast_template_app
artifacts: false
- scan_tests
artifacts:
paths:
- tools/unit-test-app/output/${IDF_TARGET}
- tools/unit-test-app/builds/*.json
2020-07-21 04:00:05 -04:00
- tools/unit-test-app/builds/${IDF_TARGET}/*/size.json
- components/idf_test/unit_test/*.yml
2020-07-21 04:00:05 -04:00
- $LOG_PATH
- $SIZE_INFO_LOCATION
when: always
expire_in: 4 days
variables:
LOG_PATH: "$CI_PROJECT_DIR/log_ut_cmake"
2020-07-21 04:00:05 -04:00
BUILD_PATH: ${CI_PROJECT_DIR}/tools/unit-test-app/builds
OUTPUT_PATH: ${CI_PROJECT_DIR}/tools/unit-test-app/output
BUILD_SYSTEM: "cmake"
TEST_TYPE: "unit_test"
PYTHON_VER: 3
script:
# RISC-V toolchain is optional but ULP may need it, so install:
- $IDF_PATH/tools/idf_tools.py install riscv-none-embed-gcc
- . $IDF_PATH/export.sh
2020-07-21 04:00:05 -04:00
- ${IDF_PATH}/tools/ci/find_apps_build_apps.sh
- cd $CI_PROJECT_DIR/tools/unit-test-app
2020-07-21 04:00:05 -04:00
- python tools/UnitTestParser.py ${BUILD_PATH}
build_esp_idf_tests_cmake_esp32:
extends: .build_esp_idf_tests_cmake
variables:
IDF_TARGET: esp32
build_esp_idf_tests_cmake_esp32s2:
extends: .build_esp_idf_tests_cmake
variables:
IDF_TARGET: esp32s2
build_esp_idf_tests_cmake_esp32s3:
extends: .build_esp_idf_tests_cmake
variables:
IDF_TARGET: esp32s3
2020-04-22 02:49:05 -04:00
.build_examples_template:
extends:
- .build_template
- .rules:build_tests:example_test-weekend_test
dependencies: # set dependencies to null to avoid missing artifacts issue
needs:
- job: fast_template_app
artifacts: false
- scan_tests
2020-07-21 04:00:05 -04:00
variables:
TEST_PREFIX: examples
TEST_RELATIVE_DIR: examples
SCAN_TEST_JSON: ${CI_PROJECT_DIR}/${TEST_RELATIVE_DIR}/test_configs/scan_${IDF_TARGET}_${BUILD_SYSTEM}.json
TEST_TYPE: example_test
LOG_PATH: ${CI_PROJECT_DIR}/log_${TEST_PREFIX}
BUILD_PATH: ${CI_PROJECT_DIR}/build_${TEST_PREFIX}
PYTHON_VER: 3
script:
2020-07-21 04:00:05 -04:00
# RISC-V toolchain is optional but ULP may need it, so install:
- $IDF_PATH/tools/idf_tools.py install riscv-none-embed-gcc
- . $IDF_PATH/export.sh
# it's not possible to build 100% out-of-tree and have the "artifacts"
# mechanism work, but this is the next best thing
2020-07-21 04:00:05 -04:00
- ${IDF_PATH}/tools/ci/find_apps_build_apps.sh
2020-04-22 02:49:05 -04:00
build_examples_make:
extends:
- .build_examples_template
2020-04-22 02:49:05 -04:00
# This is a workaround for a rarely encountered issue with building examples in CI.
# Probably related to building of Kconfig in 'make clean' stage
retry: 1
parallel: 8
2020-04-22 02:49:05 -04:00
artifacts:
paths:
- $LOG_PATH
- build_${TEST_PREFIX}/*/*/*/build/size.json
2020-07-21 04:00:05 -04:00
- $SIZE_INFO_LOCATION
when: always
expire_in: 4 days
2020-04-22 02:49:05 -04:00
variables:
BUILD_SYSTEM: make
IDF_TARGET: esp32 # currently we only support esp32
# same as above, but for CMake
.build_examples_cmake:
2020-04-22 02:49:05 -04:00
extends: .build_examples_template
artifacts:
paths:
- build_${TEST_PREFIX}/list.json
- build_${TEST_PREFIX}/list_job_*.json
- build_${TEST_PREFIX}/*/*/*/sdkconfig
- build_${TEST_PREFIX}/*/*/*/build/size.json
- build_${TEST_PREFIX}/*/*/*/build/*.bin
- build_${TEST_PREFIX}/*/*/*/build/*.elf
- build_${TEST_PREFIX}/*/*/*/build/*.map
- build_${TEST_PREFIX}/*/*/*/build/flasher_args.json
- build_${TEST_PREFIX}/*/*/*/build/bootloader/*.bin
- build_${TEST_PREFIX}/*/*/*/build/partition_table/*.bin
- $LOG_PATH
2020-07-21 04:00:05 -04:00
- $SIZE_INFO_LOCATION
when: always
expire_in: 4 days
variables:
BUILD_SYSTEM: cmake
build_examples_cmake_esp32:
extends: .build_examples_cmake
parallel: 10
variables:
IDF_TARGET: esp32
build_examples_cmake_esp32s2:
extends: .build_examples_cmake
parallel: 8
variables:
2020-01-16 22:47:08 -05:00
IDF_TARGET: esp32s2
.build_test_apps:
extends:
- .build_examples_cmake
- .rules:build_tests:custom_test-weekend_test
variables:
TEST_PREFIX: test_apps
TEST_RELATIVE_DIR: tools/test_apps
2020-07-21 04:00:05 -04:00
TEST_TYPE: custom_test
script:
2020-07-21 04:00:05 -04:00
- ${IDF_PATH}/tools/ci/find_apps_build_apps.sh
build_test_apps_esp32:
extends: .build_test_apps
parallel: 8
variables:
IDF_TARGET: esp32
build_test_apps_esp32s2:
extends: .build_test_apps
parallel: 8
variables:
IDF_TARGET: esp32s2
2020-10-20 06:08:15 -04:00
build_test_apps_esp32s3:
extends: .build_test_apps
parallel: 8
variables:
IDF_TARGET: esp32s3
.build_component_ut:
extends:
- .build_test_apps
- .rules:build_tests:unit_test
variables:
TEST_PREFIX: component_ut
TEST_RELATIVE_DIR: component_ut
build_component_ut_esp32:
extends: .build_component_ut
variables:
IDF_TARGET: esp32
build_component_ut_esp32s2:
extends: .build_component_ut
variables:
IDF_TARGET: esp32s2
.build_docs_template:
stage: build
image: $ESP_IDF_DOC_ENV_IMAGE
tags:
- build_docs
script:
- cd docs
- ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 3.6.10 pip install -r requirements.txt
- ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 3.6.10 ./build_docs.py -bs $DOC_BUILDERS -l $DOCLANG -t $DOCTGT build
parallel:
matrix:
- DOCLANG: [ "en", "zh_CN" ]
DOCTGT: [ "esp32", "esp32s2" ]
build_docs_html:
extends:
- .build_docs_template
- .rules:labels:build_docs
artifacts:
when: always
paths:
2019-11-22 02:58:32 -05:00
- docs/_build/*/*/*.txt
- docs/_build/*/*/html/*
2019-12-11 17:38:04 -05:00
expire_in: 4 days
variables:
DOC_BUILDERS: "html"
2019-11-22 02:58:32 -05:00
build_docs_pdf:
extends:
- .build_docs_template
- .rules:labels:build_docs-slim
artifacts:
when: always
paths:
- docs/_build/*/*/latex/*
expire_in: 4 days
variables:
DOC_BUILDERS: "latex"
.test_build_system_template:
extends:
- .build_template
- .rules:build_tests:weekend_test
dependencies: # set dependencies to null to avoid missing artifacts issue
needs:
- job: fast_template_app
artifacts: false
script:
- ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
- rm -rf test_build_system
- mkdir test_build_system
- cd test_build_system
- ${IDF_PATH}/tools/ci/${SHELL_TEST_SCRIPT}
test_build_system:
extends: .test_build_system_template
variables:
SHELL_TEST_SCRIPT: test_build_system.sh
test_build_system_cmake:
extends: .test_build_system_template
variables:
SHELL_TEST_SCRIPT: test_build_system_cmake.sh
2019-07-08 12:42:46 -04:00
2019-10-30 10:00:18 -04:00
test_build_system_cmake_macos:
extends:
- .test_build_system_template
- .before_script_macos
- .rules:os:mac_os
tags:
- macos_shell
variables:
SHELL_TEST_SCRIPT: test_build_system_cmake.sh
2019-10-30 10:00:18 -04:00
2019-07-08 12:42:46 -04:00
build_docker:
extends:
- .before_script_slim
- .rules:protected-schedule
2019-07-08 12:42:46 -04:00
stage: build
image: espressif/docker-builder:1
tags:
- build_docker_amd64_brno
variables:
DOCKER_TMP_IMAGE_NAME: "idf_tmp_image"
script:
2020-09-11 10:14:15 -04:00
- export LOCAL_CI_REPOSITORY_URL=$CI_REPOSITORY_URL
- if [ -n "$LOCAL_GITLAB_HTTPS_HOST" ]; then export LOCAL_CI_REPOSITORY_URL="https://gitlab-ci-token:${CI_JOB_TOKEN}@${LOCAL_GITLAB_HTTPS_HOST}/${CI_PROJECT_PATH}"; fi
- echo "Using repository at $LOCAL_CI_REPOSITORY_URL"
- export DOCKER_BUILD_ARGS="--build-arg IDF_CLONE_URL=${LOCAL_CI_REPOSITORY_URL} --build-arg IDF_CLONE_BRANCH_OR_TAG=${CI_COMMIT_REF_NAME} --build-arg IDF_CHECKOUT_REF=${CI_COMMIT_TAG:-$CI_COMMIT_SHA}"
2019-07-08 12:42:46 -04:00
# Build
- docker build --tag ${DOCKER_TMP_IMAGE_NAME} ${DOCKER_BUILD_ARGS} tools/docker/
# We can't mount $PWD/examples/get-started/blink into the container, see https://gitlab.com/gitlab-org/gitlab-ce/issues/41227.
# The workaround mentioned there works, but leaves around directories which need to be cleaned up manually.
# Therefore, build a copy of the example located inside the container.
- docker run --rm --workdir /opt/esp/idf/examples/get-started/blink ${DOCKER_TMP_IMAGE_NAME} idf.py build
.test-on-windows:
extends:
- .before_script_slim
- .rules:protected-schedule
stage: build
image: $CI_DOCKER_REGISTRY/esp32-toolchain-win-cross
tags:
- build
script:
- cd $TEST_DIR
- mkdir build
- cd build
- cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain-i686-w64-mingw32.cmake -DCMAKE_BUILD_TYPE=Release ..
- cmake --build .
build_idf_exe:
extends: .test-on-windows
artifacts:
paths:
- tools/windows/idf_exe/build/idf-exe-v*.zip
expire_in: 4 days
variables:
TEST_DIR: tools/windows/idf_exe
build_cmdlinerunner:
extends: .test-on-windows
artifacts:
paths:
- tools/windows/tool_setup/cmdlinerunner/build/cmdlinerunner.dll
2019-12-11 17:38:04 -05:00
expire_in: 4 days
variables:
TEST_DIR: tools/windows/tool_setup/cmdlinerunner
build_installer:
extends:
- .before_script_slim
- .rules:protected-schedule
# using a different stage here to be able to use artifacts from build_cmdlinerunner job
stage: host_test
image: $CI_DOCKER_REGISTRY/wine-innosetup:1
tags:
- build
dependencies: # set dependencies to null to avoid missing artifacts issue
needs:
- build_cmdlinerunner
script:
- cd tools/windows/tool_setup/
- ./build_installer.sh
# This job builds template app with permutations of targets and optimization levels
build_template_app:
needs:
- job: fast_template_app
artifacts: false
extends: .build_template_app_template
# Sonarqube related jobs put here for this reason:
# Here we have two jobs. code_quality_check and code_quality_report.
#
# code_quality_check will analyze the code changes between your MR and
# code repo stored in sonarqube server. The analysis result is only shown in
# the comments under this MR and won't be transferred to the server.
#
# code_quality_report will analyze and transfer both of the newly added code
# and the analysis result to the server.
#
# Put in the front to ensure that the newly merged code can be stored in
# sonarqube server ASAP, in order to avoid reporting unrelated code issues
.sonar_scan_template:
stage: build
image:
name: $CI_DOCKER_REGISTRY/sonarqube-scanner:2
before_script:
- source tools/ci/utils.sh
- export PYTHONPATH="$CI_PROJECT_DIR/tools:$CI_PROJECT_DIR/tools/ci/python_packages:$PYTHONPATH"
- fetch_submodules
# Exclude the submodules, all paths ends with /**
- export SUBMODULES=$(get_all_submodules)
2020-10-12 00:08:39 -04:00
# get all exclude paths specified in tools/ci/sonar_exclude_list.txt | ignore lines start with # | xargs | replace all <space> to <comma>
- export CUSTOM_EXCLUDES=$(cat $CI_PROJECT_DIR/tools/ci/sonar_exclude_list.txt | grep -v '^#' | xargs | sed -e 's/ /,/g')
# Exclude the report dir
- export EXCLUSIONS="$SUBMODULES,$REPORT_DIR/**,docs/_static/**,**/*.png,**/*.jpg"
- python $NORMALIZE_CLANGTIDY_PY $CI_PROJECT_DIR/$REPORT_DIR/warnings.txt $CI_PROJECT_DIR/$REPORT_DIR/clang_tidy_report.txt $CI_PROJECT_DIR
variables:
GIT_DEPTH: 0
NORMALIZE_CLANGTIDY_PY: $CI_PROJECT_DIR/tools/ci/normalize_clangtidy_path.py
REPORT_DIR: examples/get-started/hello_world/tidybuild/report
tags:
- host_test
dependencies: # set dependencies to null to avoid missing artifacts issue
needs:
- clang_tidy_check_regular
code_quality_check:
extends:
- .sonar_scan_template
- .rules:trigger
allow_failure: true
script:
- export CI_MR_IID=$(python ${CI_PROJECT_DIR}/tools/ci/ci_get_mr_info.py id ${CI_COMMIT_BRANCH})
- export CI_MR_COMMITS=$(python ${CI_PROJECT_DIR}/tools/ci/ci_get_mr_info.py commits ${CI_COMMIT_BRANCH} | tr '\n' ',')
# test if this branch have merge request, if not, exit 0
- test -n "$CI_MR_IID" || exit 0
- test -n "$CI_MR_COMMITS" || exit 0
2020-08-31 02:55:12 -04:00
- sonar-scanner
-Dsonar.analysis.mode=preview
-Dsonar.host.url=$SONAR_HOST_URL
-Dsonar.login=$SONAR_LOGIN
-Dsonar.sources=$CI_PROJECT_DIR
-Dsonar.sourceEncoding=UTF-8
-Dsonar.projectKey=esp-idf
-Dsonar.projectBaseDir=$CI_PROJECT_DIR
-Dsonar.exclusions=$EXCLUSIONS
-Dsonar.gitlab.project_id=$CI_PROJECT_ID
-Dsonar.gitlab.commit_sha=$CI_MR_COMMITS
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
-Dsonar.cxx.clangtidy.reportPath=$REPORT_DIR/clang_tidy_report.txt
-Dsonar.cxx.includeDirectories=components,/usr/include
-Dsonar.python.pylint_config=.pylintrc
-Dsonar.gitlab.ci_merge_request_iid=$CI_MR_IID
-Dsonar.gitlab.merge_request_discussion=true
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
code_quality_report:
extends:
- .sonar_scan_template
- .rules:protected-schedule
script:
- sonar-scanner
-Dsonar.host.url=$SONAR_HOST_URL
-Dsonar.login=$SONAR_LOGIN
-Dsonar.sources=$CI_PROJECT_DIR
-Dsonar.sourceEncoding=UTF-8
-Dsonar.projectKey=esp-idf
-Dsonar.projectBaseDir=$CI_PROJECT_DIR
-Dsonar.exclusions=$EXCLUSIONS
-Dsonar.gitlab.project_id=$CI_PROJECT_ID
-Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
-Dsonar.cxx.clangtidy.reportPath=$REPORT_DIR/clang_tidy_report.txt
-Dsonar.cxx.includeDirectories=components,/usr/include
-Dsonar.python.pylint_config=.pylintrc
-Dsonar.branch.name=$CI_COMMIT_REF_NAME