esp-idf/.gitlab/ci/build.yml

586 lines
16 KiB
YAML
Raw Normal View History

.build_template:
stage: build
extends:
- .after_script:build:ccache
image: $ESP_ENV_IMAGE
tags:
- build
# build only on shiny servers since shiny storage server is at the same location
- shiny
variables:
2021-11-05 10:26:13 -04:00
# Enable ccache for all build jobs. See configure_ci_environment.sh for more ccache related settings.
IDF_CCACHE_ENABLE: "1"
dependencies: []
.build_cmake_template:
2021-11-19 03:11:47 -05:00
extends:
- .build_template
- .before_script:build
- .after_script:build:ccache
dependencies: # set dependencies to null to avoid missing artifacts issue
2021-11-19 03:11:47 -05:00
needs:
- job: fast_template_app
artifacts: false
2023-11-01 07:43:19 -04:00
- pipeline_variables
2021-11-19 03:11:47 -05:00
artifacts:
paths:
# 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
- "**/build*/build_log.txt"
# keep the size info to help track the binary size
- size_info.txt
- "**/build*/size.json"
when: always
expire_in: 4 days
script:
# CI specific options start from "--parallel-count xxx". could ignore when running locally
- 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-11-01 07:43:19 -04:00
--modified-components ${MODIFIED_COMPONENTS}
--modified-files ${MODIFIED_FILES}
# for detailed documents, please refer to .gitlab/ci/README.md#uploaddownload-artifacts-to-internal-minio-server
- python tools/ci/artifacts_handler.py upload
.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:
# CI specific options start from "--parallel-count xxx". could ignore when running locally
- 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-11-01 07:43:19 -04:00
--modified-components ${MODIFIED_COMPONENTS}
--modified-files ${MODIFIED_FILES}
$TEST_BUILD_OPTS_EXTRA
2023-11-01 07:43:19 -04:00
- python tools/ci/artifacts_handler.py upload
.build_pytest_template:
extends:
- .build_cmake_template
script:
# CI specific options start from "--parallel-count xxx". could ignore when running locally
- run_cmd python tools/ci/ci_build_apps.py $TEST_DIR -v
-t $IDF_TARGET
-m \"not host_test\"
--pytest-apps
--parallel-count ${CI_NODE_TOTAL:-1}
--parallel-index ${CI_NODE_INDEX:-1}
--collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt"
2023-11-01 07:43:19 -04:00
--modified-components ${MODIFIED_COMPONENTS}
--modified-files ${MODIFIED_FILES}
- python tools/ci/artifacts_handler.py upload
2021-11-19 03:11:47 -05:00
2022-12-06 20:34:18 -05:00
.build_pytest_no_jtag_template:
extends:
- .build_cmake_template
2022-12-06 20:34:18 -05:00
script:
# CI specific options start from "--parallel-count xxx". could ignore when running locally
2022-12-06 20:34:18 -05:00
- run_cmd python tools/ci/ci_build_apps.py $TEST_DIR -v
-t $IDF_TARGET
-m \"not host_test and not jtag\"
--pytest-apps
--parallel-count ${CI_NODE_TOTAL:-1}
--parallel-index ${CI_NODE_INDEX:-1}
--collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt"
2023-11-01 07:43:19 -04:00
--modified-components ${MODIFIED_COMPONENTS}
--modified-files ${MODIFIED_FILES}
- python tools/ci/artifacts_handler.py upload
2022-12-06 20:34:18 -05:00
.build_pytest_jtag_template:
extends:
- .build_cmake_template
script:
# CI specific options start from "--parallel-count xxx". could ignore when running locally
2022-12-06 20:34:18 -05:00
- run_cmd python tools/ci/ci_build_apps.py $TEST_DIR -v
-t $IDF_TARGET
-m \"not host_test and jtag\"
--pytest-apps
--parallel-count ${CI_NODE_TOTAL:-1}
--parallel-index ${CI_NODE_INDEX:-1}
--collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt"
2023-11-01 07:43:19 -04:00
--modified-components ${MODIFIED_COMPONENTS}
--modified-files ${MODIFIED_FILES}
- python tools/ci/artifacts_handler.py upload
2022-12-06 20:34:18 -05:00
build_pytest_examples_esp32:
2021-11-19 03:11:47 -05:00
extends:
2022-12-06 20:34:18 -05:00
- .build_pytest_no_jtag_template
2021-11-19 03:11:47 -05:00
- .rules:build:example_test-esp32
2023-01-08 22:22:15 -05:00
parallel: 6
variables:
IDF_TARGET: esp32
TEST_DIR: examples
build_pytest_examples_esp32s2:
extends:
2022-12-06 20:34:18 -05:00
- .build_pytest_no_jtag_template
- .rules:build:example_test-esp32s2
parallel: 3
variables:
IDF_TARGET: esp32s2
TEST_DIR: examples
2021-11-19 03:11:47 -05:00
build_pytest_examples_esp32s3:
extends:
2022-12-06 20:34:18 -05:00
- .build_pytest_no_jtag_template
- .rules:build:example_test-esp32s3
2022-08-24 22:34:12 -04:00
parallel: 4
variables:
IDF_TARGET: esp32s3
TEST_DIR: examples
build_pytest_examples_esp32c3:
2021-11-19 03:11:47 -05:00
extends:
2022-12-06 20:34:18 -05:00
- .build_pytest_no_jtag_template
- .rules:build:example_test-esp32c3
2023-01-08 22:22:15 -05:00
parallel: 4
variables:
IDF_TARGET: esp32c3
TEST_DIR: examples
2021-11-19 03:11:47 -05:00
build_pytest_examples_esp32c2:
extends:
2022-12-06 20:34:18 -05:00
- .build_pytest_no_jtag_template
- .rules:build:example_test-esp32c2
2023-01-08 22:22:15 -05:00
parallel: 2
variables:
IDF_TARGET: esp32c2
TEST_DIR: examples
build_pytest_examples_esp32c6:
extends:
- .build_pytest_no_jtag_template
- .rules:build:example_test-esp32c6
2023-01-08 22:22:15 -05:00
parallel: 2
variables:
IDF_TARGET: esp32c6
TEST_DIR: examples
2023-01-10 00:59:46 -05:00
build_pytest_examples_esp32h2:
extends:
- .build_pytest_no_jtag_template
2023-01-10 00:59:46 -05:00
- .rules:build:example_test-esp32h2
parallel: 2
2023-01-10 00:59:46 -05:00
variables:
IDF_TARGET: esp32h2
TEST_DIR: examples
build_pytest_examples_jtag: # for all targets
extends:
- .build_pytest_jtag_template
- .rules:build:example_test
variables:
IDF_TARGET: all
TEST_DIR: examples
build_pytest_components_esp32:
extends:
- .build_pytest_template
- .rules:build:component_ut-esp32
2023-01-08 22:22:15 -05:00
parallel: 5
variables:
IDF_TARGET: esp32
TEST_DIR: components
build_pytest_components_esp32s2:
extends:
- .build_pytest_template
- .rules:build:component_ut-esp32s2
2023-01-08 22:22:15 -05:00
parallel: 4
variables:
IDF_TARGET: esp32s2
TEST_DIR: components
build_pytest_components_esp32s3:
extends:
- .build_pytest_template
- .rules:build:component_ut-esp32s3
2023-01-08 22:22:15 -05:00
parallel: 4
variables:
IDF_TARGET: esp32s3
TEST_DIR: components
build_pytest_components_esp32c3:
extends:
- .build_pytest_template
- .rules:build:component_ut-esp32c3
2023-01-08 22:22:15 -05:00
parallel: 4
variables:
IDF_TARGET: esp32c3
TEST_DIR: components
build_pytest_components_esp32c2:
extends:
- .build_pytest_template
- .rules:build:component_ut-esp32c2
2023-01-08 22:22:15 -05:00
parallel: 3
variables:
IDF_TARGET: esp32c2
TEST_DIR: components
build_pytest_components_esp32c6:
extends:
- .build_pytest_template
- .rules:build:component_ut-esp32c6
2023-01-08 22:22:15 -05:00
parallel: 3
variables:
IDF_TARGET: esp32c6
TEST_DIR: components
2023-01-10 00:59:46 -05:00
build_pytest_components_esp32h2:
extends:
- .build_pytest_template
- .rules:build:component_ut-esp32h2
parallel: 4
2023-01-10 00:59:46 -05:00
variables:
IDF_TARGET: esp32h2
TEST_DIR: components
build_only_components_apps:
extends:
- .build_cmake_template
- .rules:build:component_ut
2023-01-08 22:22:15 -05:00
parallel: 5
script:
- set_component_ut_vars
# CI specific options start from "--parallel-count xxx". could ignore when running locally
- run_cmd python tools/ci/ci_build_apps.py $COMPONENT_UT_DIRS -v
-t all
--parallel-count ${CI_NODE_TOTAL:-1}
--parallel-index ${CI_NODE_INDEX:-1}
2023-11-01 07:43:19 -04:00
--modified-components ${MODIFIED_COMPONENTS}
--modified-files ${MODIFIED_FILES}
- python tools/ci/artifacts_handler.py upload
2022-02-11 02:47:32 -05:00
build_pytest_test_apps_esp32:
extends:
- .build_pytest_template
2022-02-11 02:47:32 -05:00
- .rules:build:custom_test-esp32
variables:
IDF_TARGET: esp32
TEST_DIR: tools/test_apps
2022-02-11 02:47:32 -05:00
build_pytest_test_apps_esp32s2:
extends:
- .build_pytest_template
2022-02-11 02:47:32 -05:00
- .rules:build:custom_test-esp32s2
variables:
IDF_TARGET: esp32s2
TEST_DIR: tools/test_apps
2022-02-11 02:47:32 -05:00
build_pytest_test_apps_esp32s3:
2022-01-28 23:09:04 -05:00
extends:
- .build_pytest_template
- .rules:build:custom_test-esp32s3
2023-01-08 22:22:15 -05:00
parallel: 2
variables:
IDF_TARGET: esp32s3
TEST_DIR: tools/test_apps
build_pytest_test_apps_esp32c3:
extends:
- .build_pytest_template
- .rules:build:custom_test-esp32c3
variables:
IDF_TARGET: esp32c3
TEST_DIR: tools/test_apps
build_pytest_test_apps_esp32c2:
extends:
- .build_pytest_template
- .rules:build:custom_test-esp32c2
variables:
IDF_TARGET: esp32c2
TEST_DIR: tools/test_apps
2022-01-28 23:09:04 -05:00
build_pytest_test_apps_esp32c6:
extends:
- .build_pytest_template
- .rules:build:custom_test-esp32c6
variables:
IDF_TARGET: esp32c6
TEST_DIR: tools/test_apps
2023-01-10 00:59:46 -05:00
build_pytest_test_apps_esp32h2:
extends:
- .build_pytest_template
2023-01-10 00:59:46 -05:00
- .rules:build:custom_test-esp32h2
variables:
IDF_TARGET: esp32h2
TEST_DIR: tools/test_apps
build_only_tools_test_apps:
extends:
- .build_cmake_template
- .rules:build:custom_test
parallel: 9
script:
# CI specific options start from "--parallel-count xxx". could ignore when running locally
- run_cmd python tools/ci/ci_build_apps.py tools/test_apps -v
-t all
--parallel-count ${CI_NODE_TOTAL:-1}
--parallel-index ${CI_NODE_INDEX:-1}
2023-11-01 07:43:19 -04:00
--modified-components ${MODIFIED_COMPONENTS}
--modified-files ${MODIFIED_FILES}
- python tools/ci/artifacts_handler.py upload
.build_template_app_template:
extends:
- .build_template
- .before_script:build
variables:
LOG_PATH: "${CI_PROJECT_DIR}/log_template_app"
BUILD_PATH: "${CI_PROJECT_DIR}/build_template_app"
BUILD_DIR: "${BUILD_PATH}/@t/@w"
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
expire_in: 1 week
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"
# 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:
extends:
- .build_template_app_template
- .rules:build:target_test
stage: pre_check
variables:
BUILD_COMMAND_ARGS: "-p"
#------------------------------------------------------------------------------
build_examples_cmake_esp32:
extends:
- .build_cmake_template
- .rules:build:example_test-esp32
2023-01-08 22:22:15 -05:00
parallel: 8
variables:
IDF_TARGET: esp32
TEST_DIR: examples
build_examples_cmake_esp32s2:
extends:
- .build_cmake_template
- .rules:build:example_test-esp32s2
2023-01-08 22:22:15 -05:00
parallel: 7
variables:
2020-01-16 22:47:08 -05:00
IDF_TARGET: esp32s2
TEST_DIR: examples
2021-09-15 23:16:52 -04:00
build_examples_cmake_esp32s3:
extends:
- .build_cmake_template
2021-09-15 23:16:52 -04:00
- .rules:build:example_test-esp32s3
parallel: 11
2021-09-15 23:16:52 -04:00
variables:
IDF_TARGET: esp32s3
TEST_DIR: examples
2021-09-15 23:16:52 -04:00
build_examples_cmake_esp32c2:
extends:
- .build_cmake_template
- .rules:build:example_test-esp32c2
parallel: 7
variables:
IDF_TARGET: esp32c2
TEST_DIR: examples
build_examples_cmake_esp32c3:
extends:
- .build_cmake_template
- .rules:build:example_test-esp32c3
parallel: 9
variables:
IDF_TARGET: esp32c3
TEST_DIR: examples
build_examples_cmake_esp32c6:
extends:
- .build_cmake_template
- .rules:build:example_test-esp32c6
parallel: 11
variables:
IDF_TARGET: esp32c6
TEST_DIR: examples
2023-01-10 00:59:46 -05:00
build_examples_cmake_esp32h2:
extends:
- .build_cmake_template
- .rules:build:example_test-esp32h2
parallel: 9
2023-01-10 00:59:46 -05:00
variables:
IDF_TARGET: esp32h2
TEST_DIR: examples
build_examples_cmake_esp32p4:
extends:
- .build_cmake_template
- .rules:build:example_test-esp32p4
parallel: 4
variables:
IDF_TARGET: esp32p4
TEST_DIR: examples
build_clang_test_apps_esp32:
extends:
- .build_cmake_clang_template
- .rules:build:custom_test-esp32
variables:
IDF_TARGET: esp32
build_clang_test_apps_esp32s2:
extends:
- .build_cmake_clang_template
- .rules:build:custom_test-esp32s2
variables:
IDF_TARGET: esp32s2
build_clang_test_apps_esp32s3:
extends:
- .build_cmake_clang_template
- .rules:build:custom_test-esp32s3
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
- .rules:build:custom_test-esp32c3
variables:
IDF_TARGET: esp32c3
build_clang_test_apps_esp32c2:
extends:
- .build_clang_test_apps_riscv
- .rules:build:custom_test-esp32c2
variables:
IDF_TARGET: esp32c2
build_clang_test_apps_esp32c6:
extends:
- .build_clang_test_apps_riscv
- .rules:build:custom_test-esp32c6
# TODO: c6 builds fail in master due to missing headers
allow_failure: true
variables:
IDF_TARGET: esp32c6
.test_build_system_template:
stage: host_test
extends:
- .build_template
- .rules:build:check
needs:
- job: fast_template_app
artifacts: false
optional: true
script:
- ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
- cd ${IDF_PATH}/tools/test_build_system
- retry_failed git clone $KNOWN_FAILURE_CASES_REPO known_failure_cases
- pytest --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
--ignore-result-files known_failure_cases/known_failure_cases.txt
pytest_build_system:
extends: .test_build_system_template
parallel: 3
artifacts:
paths:
- XUNIT_RESULT.xml
- test_build_system
when: always
expire_in: 2 days
reports:
junit: XUNIT_RESULT.xml
pytest_build_system_macos:
extends:
- .test_build_system_template
- .before_script:build:macos
- .rules:build:macos
tags:
- macos_shell
parallel: 3
artifacts:
paths:
- XUNIT_RESULT.xml
- test_build_system
when: always
expire_in: 2 days
reports:
junit: XUNIT_RESULT.xml
2019-07-08 12:42:46 -04:00
build_docker:
extends:
- .before_script:minimal
- .rules:build:docker
stage: host_test
needs: []
2019-07-08 12:42:46 -04:00
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
- if [ -n "$LOCAL_GIT_MIRROR" ]; then export LOCAL_CI_REPOSITORY_URL="${LOCAL_GIT_MIRROR}/${CI_PROJECT_PATH}"; fi
2020-09-11 10:14:15 -04:00
- 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:-$PIPELINE_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
# This job builds template app with permutations of targets and optimization levels
build_template_app:
extends:
- .build_template_app_template
- .rules:build
stage: host_test
needs:
- job: fast_template_app
artifacts: false