2019-06-29 00:39:21 +08:00
.build_template :
stage : build
2023-09-26 13:24:26 +02:00
extends :
2023-12-18 15:29:58 +01:00
- .after_script:build:ccache:upload-when-fail
2021-05-26 10:44:20 +02:00
image : $ESP_ENV_IMAGE
2019-06-29 00:39:21 +08:00
tags :
- build
2023-01-16 18:23:57 +08:00
# build only on shiny servers since shiny storage server is at the same location
- shiny
2019-06-29 00:39:21 +08:00
variables :
2021-11-05 15:26:13 +01:00
# Enable ccache for all build jobs. See configure_ci_environment.sh for more ccache related settings.
IDF_CCACHE_ENABLE : "1"
2020-11-19 15:08:53 +08:00
dependencies : [ ]
2019-06-29 00:39:21 +08:00
2022-08-26 12:24:19 +08:00
.build_cmake_template :
2021-11-19 16:11:47 +08:00
extends :
- .build_template
2023-09-26 13:24:26 +02:00
- .before_script:build
2023-08-31 12:55:28 +08:00
- .after_script:build:ccache
2022-08-26 12:24:19 +08:00
dependencies : # set dependencies to null to avoid missing artifacts issue
2021-11-19 16:11:47 +08:00
needs :
- job : fast_template_app
artifacts : false
2023-11-01 12:43:19 +01:00
- pipeline_variables
2021-11-19 16:11:47 +08:00
artifacts :
paths :
2023-08-31 12:55:28 +08:00
# The other artifacts patterns are defined under tools/ci/artifacts_handler.py
# Now we're uploading/downloading the binary files from our internal storage server
#
# keep the log file to help debug
2022-07-13 10:34:02 +08:00
- "**/build*/build_log.txt"
2023-08-31 12:55:28 +08:00
# keep the size info to help track the binary size
2022-08-26 12:24:19 +08:00
- size_info.txt
2023-08-31 12:55:28 +08:00
- "**/build*/size.json"
2024-02-16 13:43:53 +01:00
expire_in : 1 week
when : always
2022-08-26 12:24:19 +08:00
script :
2023-05-24 10:53:57 +08:00
# CI specific options start from "--parallel-count xxx". could ignore when running locally
2022-08-26 12:24:19 +08:00
- run_cmd python tools/ci/ci_build_apps.py $TEST_DIR -v
-t $IDF_TARGET
--copy-sdkconfig
--parallel-count ${CI_NODE_TOTAL:-1}
--parallel-index ${CI_NODE_INDEX:-1}
--extra-preserve-dirs
examples/bluetooth/esp_ble_mesh/ble_mesh_console
examples/bluetooth/hci/controller_hci_uart_esp32
examples/wifi/iperf
2023-12-18 15:29:58 +01:00
--modified-components ${MR_MODIFIED_COMPONENTS}
--modified-files ${MR_MODIFIED_FILES}
2023-11-03 18:09:34 +08:00
# for detailed documents, please refer to .gitlab/ci/README.md#uploaddownload-artifacts-to-internal-minio-server
- python tools/ci/artifacts_handler.py upload
2022-08-26 12:24:19 +08:00
2022-11-18 15:29:39 +03:00
.build_cmake_clang_template :
extends :
- .build_cmake_template
variables :
IDF_TOOLCHAIN : clang
TEST_BUILD_OPTS_EXTRA : ""
TEST_DIR : tools/test_apps/system/cxx_pthread_bluetooth
script :
2023-05-24 10:53:57 +08:00
# CI specific options start from "--parallel-count xxx". could ignore when running locally
2022-11-18 15:29:39 +03:00
- run_cmd python tools/ci/ci_build_apps.py $TEST_DIR -v
-t $IDF_TARGET
--copy-sdkconfig
--parallel-count ${CI_NODE_TOTAL:-1}
--parallel-index ${CI_NODE_INDEX:-1}
2023-12-18 15:29:58 +01:00
--modified-components ${MR_MODIFIED_COMPONENTS}
--modified-files ${MR_MODIFIED_FILES}
2022-11-18 15:29:39 +03:00
$TEST_BUILD_OPTS_EXTRA
2023-11-03 18:09:34 +08:00
- python tools/ci/artifacts_handler.py upload
2022-11-18 15:29:39 +03:00
2023-12-18 15:29:58 +01:00
######################
# build_template_app #
######################
2020-09-27 11:20:53 +08:00
.build_template_app_template :
2022-07-13 10:34:02 +08:00
extends :
- .build_template
2023-09-26 13:24:26 +02:00
- .before_script:build
2020-09-27 11:20:53 +08:00
variables :
LOG_PATH : "${CI_PROJECT_DIR}/log_template_app"
BUILD_PATH : "${CI_PROJECT_DIR}/build_template_app"
2023-04-07 19:44:42 +08:00
BUILD_DIR : "${BUILD_PATH}/@t/@w"
2020-09-27 11:20:53 +08:00
BUILD_LOG_CMAKE : "${LOG_PATH}/cmake_@t_@w.txt"
BUILD_COMMAND_ARGS : ""
artifacts :
paths :
- log_template_app/*
- size_info.txt
- build_template_app/**/size.json
2024-02-16 13:43:53 +01:00
expire_in : 1 week
when : always
2020-09-27 11:20:53 +08:00
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"}
2020-09-28 14:27:10 +08:00
- retry_failed git clone ${ESP_IDF_TEMPLATE_GIT}
2020-09-27 11:20:53 +08:00
# 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"
# 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}
# 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 :
2020-11-10 17:48:35 +08:00
extends :
- .build_template_app_template
2021-02-22 16:53:37 +08:00
- .rules:build:target_test
2020-09-27 11:20:53 +08:00
stage : pre_check
2024-01-30 21:36:00 +08:00
tags : [ fast_run, shiny]
2020-09-27 11:20:53 +08:00
variables :
BUILD_COMMAND_ARGS : "-p"
#------------------------------------------------------------------------------
2023-12-18 15:29:58 +01:00
########################################
# Clang Build Apps Without Tests Cases #
########################################
2022-11-18 15:29:39 +03:00
build_clang_test_apps_esp32 :
extends :
- .build_cmake_clang_template
2023-12-18 15:29:58 +01:00
- .rules:build
2022-11-18 15:29:39 +03:00
variables :
IDF_TARGET : esp32
build_clang_test_apps_esp32s2 :
extends :
- .build_cmake_clang_template
2023-12-18 15:29:58 +01:00
- .rules:build
2022-11-18 15:29:39 +03:00
variables :
IDF_TARGET : esp32s2
build_clang_test_apps_esp32s3 :
extends :
- .build_cmake_clang_template
2023-12-18 15:29:58 +01:00
- .rules:build
2022-11-18 15:29:39 +03:00
variables :
IDF_TARGET : esp32s3
.build_clang_test_apps_riscv :
extends :
- .build_cmake_clang_template
variables :
# For RISCV clang generates '.linker-options' sections of type 'llvm_linker_options' in asm files.
# See (https://llvm.org/docs/Extensions.html#linker-options-section-linker-options).
# Binutils gas ignores them with warning.
# TODO: LLVM-112, Use integrated assembler.
TEST_BUILD_OPTS_EXTRA : "--ignore-warning-str 'Warning: unrecognized section type'"
build_clang_test_apps_esp32c3 :
extends :
- .build_clang_test_apps_riscv
2023-12-18 15:29:58 +01:00
- .rules:build
2022-11-18 15:29:39 +03:00
variables :
IDF_TARGET : esp32c3
build_clang_test_apps_esp32c2 :
extends :
- .build_clang_test_apps_riscv
2023-12-18 15:29:58 +01:00
- .rules:build
2022-11-18 15:29:39 +03:00
variables :
IDF_TARGET : esp32c2
build_clang_test_apps_esp32c6 :
extends :
- .build_clang_test_apps_riscv
2023-12-18 15:29:58 +01:00
- .rules:build
2022-11-18 15:29:39 +03:00
# TODO: c6 builds fail in master due to missing headers
allow_failure : true
variables :
IDF_TARGET : esp32c6
2023-12-18 15:29:58 +01:00
######################
# Build System Tests #
######################
2020-09-27 11:20:53 +08:00
.test_build_system_template :
2021-06-29 19:35:37 +08:00
stage : host_test
2020-09-27 11:20:53 +08:00
extends :
- .build_template
2023-07-14 20:15:50 +08:00
- .rules:build:check
2024-01-25 12:45:13 +01:00
dependencies : # set dependencies to null to avoid missing artifacts issue
2020-11-10 17:48:35 +08:00
needs :
- job : fast_template_app
artifacts : false
2023-07-14 20:15:50 +08:00
optional : true
2024-02-16 13:43:53 +01:00
artifacts :
reports :
junit : XUNIT_RESULT.xml
paths :
- XUNIT_RESULT.xml
- test_build_system
expire_in : 1 week
when : always
2019-06-29 00:39:21 +08:00
script :
- ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
2023-08-10 13:02:13 +02:00
- cd ${IDF_PATH}/tools/test_build_system
2024-01-26 10:36:26 +08:00
- python ${IDF_PATH}/tools/ci/get_known_failure_cases_file.py
2024-04-16 14:11:31 +02:00
- pytest
--cleanup-idf-copy
--parallel-count ${CI_NODE_TOTAL:-1}
--parallel-index ${CI_NODE_INDEX:-1}
--work-dir ${CI_PROJECT_DIR}/test_build_system
--junitxml ${CI_PROJECT_DIR}/XUNIT_RESULT.xml
2023-12-06 14:10:41 +08:00
--ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME}
2020-09-27 11:20:53 +08:00
2022-08-09 02:11:57 +02:00
pytest_build_system :
extends : .test_build_system_template
2023-04-11 12:29:11 +02:00
parallel : 3
2023-08-10 13:02:13 +02:00
pytest_build_system_macos :
extends :
- .test_build_system_template
2023-09-26 13:24:26 +02:00
- .before_script:build:macos
2024-04-16 15:01:02 +02:00
- .after_script:build:macos:upload-when-fail
2023-08-10 13:02:13 +02:00
- .rules:build:macos
tags :
- macos_shell
parallel : 3
2024-04-16 15:31:45 +02:00
variables :
PYENV_VERSION : "3.8"
2024-04-16 15:01:02 +02:00
CI_CCACHE_DISABLE : "1" # ccache: error: Read-only file system
2023-10-20 10:40:07 +02:00
2019-07-08 18:42:46 +02:00
build_docker :
2020-09-27 11:20:53 +08:00
extends :
2023-09-26 13:24:26 +02:00
- .before_script:minimal
2021-02-09 12:31:38 +08:00
- .rules:build:docker
2021-06-29 19:35:37 +08:00
stage : host_test
2021-08-10 11:29:25 +03:00
needs : [ ]
2019-07-08 18:42:46 +02:00
image : espressif/docker-builder:1
tags :
- build_docker_amd64_brno
variables :
DOCKER_TMP_IMAGE_NAME : "idf_tmp_image"
script :
2020-09-11 16:14:15 +02: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
2021-11-24 10:20:11 +01:00
- if [ -n "$LOCAL_GIT_MIRROR" ]; then export LOCAL_CI_REPOSITORY_URL="${LOCAL_GIT_MIRROR}/${CI_PROJECT_PATH}"; fi
2020-09-11 16:14:15 +02:00
- echo "Using repository at $LOCAL_CI_REPOSITORY_URL"
2021-10-28 11:07:02 +07:00
- 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:-$PIPELINE_COMMIT_SHA}"
2019-07-08 18:42:46 +02: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
2019-07-18 17:34:36 +02:00
2020-07-16 00:18:33 +08:00
# This job builds template app with permutations of targets and optimization levels
build_template_app :
2021-02-09 12:31:38 +08:00
extends :
- .build_template_app_template
- .rules:build
2021-06-29 19:35:37 +08:00
stage : host_test
2024-01-25 12:45:13 +01:00
dependencies : # set dependencies to null to avoid missing artifacts issue
2020-11-10 17:48:35 +08:00
needs :
- job : fast_template_app
artifacts : false
2023-12-18 15:29:58 +01:00
####################
# Dynamic Pipeline #
####################
generate_build_child_pipeline :
extends :
- .build_template
2024-01-30 21:36:00 +08:00
tags : [ fast_run, shiny]
2023-12-18 15:29:58 +01:00
dependencies : # set dependencies to null to avoid missing artifacts issue
needs :
- pipeline_variables
artifacts :
paths :
- build_child_pipeline.yml
- test_related_apps.txt
- non_test_related_apps.txt
2024-02-16 13:43:53 +01:00
expire_in : 1 week
when : always
2023-12-18 15:29:58 +01:00
script :
- run_cmd python tools/ci/dynamic_pipelines/scripts/generate_build_child_pipeline.py
build_child_pipeline :
stage : build
needs :
- job : fast_template_app
2024-01-11 06:41:58 +01:00
optional : true
2023-12-18 15:29:58 +01:00
artifacts : false
- pipeline_variables
- generate_build_child_pipeline
variables :
IS_MR_PIPELINE : $IS_MR_PIPELINE
MR_MODIFIED_COMPONENTS : $MR_MODIFIED_COMPONENTS
MR_MODIFIED_FILES : $MR_MODIFIED_FILES
PARENT_PIPELINE_ID : $CI_PIPELINE_ID
BUILD_AND_TEST_ALL_APPS : $BUILD_AND_TEST_ALL_APPS
# https://gitlab.com/gitlab-org/gitlab/-/issues/214340
inherit :
variables : false
trigger :
include :
- artifact : build_child_pipeline.yml
job : generate_build_child_pipeline
strategy : depend