From 2a492a5fb20262e0767e573d9c6d32b5ebaba079 Mon Sep 17 00:00:00 2001 From: Pengyu Lv Date: Mon, 14 Oct 2024 16:30:33 +0800 Subject: [PATCH 1/3] refactor(ci): new impl to build using local libs Signed-off-by: Pengyu Lv --- .gitlab-ci.yml | 5 ++--- tools/ci/build_apps.py | 2 +- tools/ci/update_cmake_files.sh | 40 ++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100755 tools/ci/update_cmake_files.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1985c55..b8aa173 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,15 +36,14 @@ before_script: - cd ${ESP_ZBOSS_LIB_PATH} - echo $(git branch --show-current) - echo $(git log -1 --oneline) - - cp -r ${ESP_ZBOSS_LIB_PATH} ${IDF_PATH}/components/espressif__esp-zboss-lib .update_zigbee_lib_script: &update_zigbee_lib_script - *setup_idf - *setup_esp_zboss_lib - - cp -r ${ESP_ZIGBEE_SDK_PATH}/components/esp-zigbee-lib ${IDF_PATH}/components/espressif__esp-zigbee-lib - cd ${ESP_ZIGBEE_SDK_PATH} - echo $(git branch --show-current) - echo $(git log -1 --oneline) + - bash ./tools/ci/update_cmake_files.sh - pip install -r tools/ci/requirements-build.txt .build_rcp_gateway: &build_rcp_gateway @@ -88,7 +87,7 @@ build_non_pytest_host: when: always expire_in: 4 days script: - - *setup_idf + - *update_zigbee_lib_script - cd ${ESP_ZIGBEE_SDK_PATH} - python tools/ci/build_apps.py ./examples --host tags: diff --git a/tools/ci/build_apps.py b/tools/ci/build_apps.py index f0ff3a6..04fad6e 100644 --- a/tools/ci/build_apps.py +++ b/tools/ci/build_apps.py @@ -171,7 +171,7 @@ def update_component_yml_files(): def main(args: argparse.Namespace) -> None: current_dir = os.getcwd() # update_sdkconfig_files() - update_component_yml_files() + # update_component_yml_files() os.chdir(current_dir) apps = get_cmake_apps(args.paths, args.target, args.config) diff --git a/tools/ci/update_cmake_files.sh b/tools/ci/update_cmake_files.sh new file mode 100755 index 0000000..9f75753 --- /dev/null +++ b/tools/ci/update_cmake_files.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +ESP_ZIGBEE_SDK="$(realpath ${SCRIPT_DIR}/../..)" + +declare -A LIB_COMPONENTS=( + ["espressif__esp-zigbee-lib"]="${ESP_ZIGBEE_SDK}/components/esp-zigbee-lib" + ["espressif__esp-zboss-lib"]="${IDF_PATH}/../esp-zboss-lib" +) + +set -ex +shopt -s globstar # Allow ** for recursive matches + +update_dependency(){ + # Remove the dependencies on managed LIB components. + # for examples in ESP-ZIGBEE-SDK + sed -i "/\besp-zboss-lib\b/d;/\besp-zigbee-lib\b/d" "${ESP_ZIGBEE_SDK}"/examples/**/main/idf_component.yml + # for components in ESP-ZIGBEE-SDK + sed -i "/\besp-zboss-lib\b/d;/\besp-zigbee-lib\b/d" "${ESP_ZIGBEE_SDK}"/components/*/idf_component.yml + + # Link the local LIB components to the components directory of ESP-IDF + for component in "${!LIB_COMPONENTS[@]}"; do + local link_name="${IDF_PATH}/components/${component}" + local link_target="${LIB_COMPONENTS[${component}]}" + if [ ! -e "${link_name}" ]; then + ln -s "${link_target}" "${link_name}" + fi + echo "create link ${link_name} -> ${link_target}" + done +} + +main() { + pushd "$(pwd)" + + update_dependency + + popd +} + +main From 731f778c280438bf93e4bcc266d15694b5a7bb63 Mon Sep 17 00:00:00 2001 From: Pengyu Lv Date: Mon, 14 Oct 2024 16:36:53 +0800 Subject: [PATCH 2/3] change: remove unused files for CI Signed-off-by: Pengyu Lv --- tools/ci/build_apps.py | 86 ------------------- .../adt_idf_component.yml | 9 -- .../gw_idf_component.yml | 9 -- .../light_idf_component.yml | 6 -- .../ncp_idf_component.yml | 8 -- .../ota_idf_component.yml | 6 -- 6 files changed, 124 deletions(-) delete mode 100644 tools/managed_component_yml/adt_idf_component.yml delete mode 100644 tools/managed_component_yml/gw_idf_component.yml delete mode 100644 tools/managed_component_yml/light_idf_component.yml delete mode 100644 tools/managed_component_yml/ncp_idf_component.yml delete mode 100644 tools/managed_component_yml/ota_idf_component.yml diff --git a/tools/ci/build_apps.py b/tools/ci/build_apps.py index 04fad6e..658b476 100644 --- a/tools/ci/build_apps.py +++ b/tools/ci/build_apps.py @@ -84,94 +84,8 @@ def get_cmake_apps( ) return apps - -def update_component_yml_files(): - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_customized_devices', 'customized_client')) - os.remove('main/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_customized_devices', 'customized_server')) - os.remove('main/idf_component.yml') - os.system(f'cp {os.path.join(PROJECT_ROOT, "tools", "managed_component_yml", "light_idf_component.yml")} main' - f'/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_ota', 'ota_client')) - os.remove('main/idf_component.yml') - os.system( - f'cp {os.path.join(PROJECT_ROOT, "tools", "managed_component_yml", "ota_idf_component.yml")} main' - f'/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_ota', 'ota_server')) - os.remove('main/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_gateway')) - os.remove('main/idf_component.yml') - os.system( - f'cp {os.path.join(PROJECT_ROOT, "tools", "managed_component_yml", "gw_idf_component.yml")} main' - f'/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_HA_sample', 'HA_color_dimmable_light')) - os.remove('main/idf_component.yml') - os.system(f'cp {os.path.join(PROJECT_ROOT, "tools", "managed_component_yml", "light_idf_component.yml")} main' - f'/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_HA_sample', 'HA_color_dimmable_switch')) - os.remove('main/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_HA_sample', 'HA_on_off_switch')) - os.remove('main/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_HA_sample', 'HA_on_off_light')) - os.remove('main/idf_component.yml') - os.system( - f'cp {os.path.join(PROJECT_ROOT, "tools", "managed_component_yml", "light_idf_component.yml")} main' - f'/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_HA_sample', 'HA_temperature_sensor')) - os.remove('main/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_HA_sample', 'HA_thermostat')) - os.remove('main/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_touchlink', 'touchlink_light')) - os.remove('main/idf_component.yml') - os.system( - f'cp {os.path.join(PROJECT_ROOT, "tools", "managed_component_yml", "light_idf_component.yml")} main' - f'/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_touchlink', 'touchlink_switch')) - os.remove('main/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_sleep', 'deep_sleep')) - os.remove('main/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_sleep', 'light_sleep')) - os.remove('main/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_greenpower', 'esp_zigbee_gpc')) - os.remove('main/idf_component.yml') - os.system( - f'cp {os.path.join(PROJECT_ROOT, "tools", "managed_component_yml", "light_idf_component.yml")} main' - f'/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_greenpower', 'esp_zigbee_gpd')) - os.remove('main/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_ncp')) - os.remove('main/idf_component.yml') - os.system( - f'cp {os.path.join(PROJECT_ROOT, "tools", "managed_component_yml", "ncp_idf_component.yml")} main' - f'/idf_component.yml') - - os.chdir(os.path.join(DEF_APP_PATH, 'esp_zigbee_all_device_types_app')) - os.remove('main/idf_component.yml') - os.system( - f'cp {os.path.join(PROJECT_ROOT, "tools", "managed_component_yml", "adt_idf_component.yml")} main' - f'/idf_component.yml') - def main(args: argparse.Namespace) -> None: current_dir = os.getcwd() - # update_sdkconfig_files() - # update_component_yml_files() os.chdir(current_dir) apps = get_cmake_apps(args.paths, args.target, args.config) diff --git a/tools/managed_component_yml/adt_idf_component.yml b/tools/managed_component_yml/adt_idf_component.yml deleted file mode 100644 index a32c964..0000000 --- a/tools/managed_component_yml/adt_idf_component.yml +++ /dev/null @@ -1,9 +0,0 @@ -## IDF Component Manager Manifest File -dependencies: - cmake_utilities: "0.*" - espressif/esp-zigbee-console: - version: "1.*" - override_path: "../../../components/esp-zigbee-console" - ## Required IDF version - idf: - version: ">=5.0.0" \ No newline at end of file diff --git a/tools/managed_component_yml/gw_idf_component.yml b/tools/managed_component_yml/gw_idf_component.yml deleted file mode 100644 index d770d52..0000000 --- a/tools/managed_component_yml/gw_idf_component.yml +++ /dev/null @@ -1,9 +0,0 @@ -## IDF Component Manager Manifest File -dependencies: - espressif/esp_rcp_update: "~0.3.0" - espressif/esp-serial-flasher: "~0.0.4" - ## Required IDF version - idf: - version: ">=5.0.0" - protocol_examples_common: - path: ${IDF_PATH}/examples/common_components/protocol_examples_common diff --git a/tools/managed_component_yml/light_idf_component.yml b/tools/managed_component_yml/light_idf_component.yml deleted file mode 100644 index 0beb6ea..0000000 --- a/tools/managed_component_yml/light_idf_component.yml +++ /dev/null @@ -1,6 +0,0 @@ -## IDF Component Manager Manifest File -dependencies: - espressif/led_strip: "~2.0.0" - ## Required IDF version - idf: - version: ">=5.0.0" diff --git a/tools/managed_component_yml/ncp_idf_component.yml b/tools/managed_component_yml/ncp_idf_component.yml deleted file mode 100644 index b02f71d..0000000 --- a/tools/managed_component_yml/ncp_idf_component.yml +++ /dev/null @@ -1,8 +0,0 @@ -## IDF Component Manager Manifest File -dependencies: - espressif/esp-zigbee-ncp: - version: "1.*" - override_path: "../../../components/esp-zigbee-ncp" - ## Required IDF version - idf: - version: ">=5.0.0" \ No newline at end of file diff --git a/tools/managed_component_yml/ota_idf_component.yml b/tools/managed_component_yml/ota_idf_component.yml deleted file mode 100644 index 77258da..0000000 --- a/tools/managed_component_yml/ota_idf_component.yml +++ /dev/null @@ -1,6 +0,0 @@ -## IDF Component Manager Manifest File -dependencies: - espressif/esp_delta_ota: "~1.1.0" - ## Required IDF version - idf: - version: ">=5.0.0" From 451f843369b37eb71e8f1865dda1702f4a75d9d2 Mon Sep 17 00:00:00 2001 From: Pengyu Lv Date: Mon, 14 Oct 2024 17:10:04 +0800 Subject: [PATCH 3/3] change(ci): test build ncp host example via non_pytest job Signed-off-by: Pengyu Lv --- .gitlab-ci.yml | 13 ------------- tools/ci/build_apps.py | 16 +--------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b8aa173..6b0a2e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -80,19 +80,6 @@ build_non_pytest_examples: tags: - build -build_non_pytest_host: - stage: build - image: ${CI_DOCKER_REGISTRY}/esp-env-v5.3:1 - artifacts: - when: always - expire_in: 4 days - script: - - *update_zigbee_lib_script - - cd ${ESP_ZIGBEE_SDK_PATH} - - python tools/ci/build_apps.py ./examples --host - tags: - - build - build_pytest_examples: stage: build image: ${CI_DOCKER_REGISTRY}/esp-env-v5.3:1 diff --git a/tools/ci/build_apps.py b/tools/ci/build_apps.py index 658b476..8d8366b 100644 --- a/tools/ci/build_apps.py +++ b/tools/ci/build_apps.py @@ -44,12 +44,6 @@ GATEWAY_APPS = [{"target": "esp32h2", "name": "esp_zigbee_all_device_types_app"},] -HOST_APPS = [{"target": "esp32", "name": "esp_zigbee_host"}, - {"target": "esp32s2", "name": "esp_zigbee_host"}, - {"target": "esp32c3", "name": "esp_zigbee_host"}, - {"target": "esp32s3", "name": "esp_zigbee_host"}, - {"target": "esp32h2", "name": "esp_zigbee_host"}, - {"target": "esp32c6", "name": "esp_zigbee_host"}, ] IGNORE_WARNINGS = [ r"warning: 'init_spiffs' defined but not used", @@ -93,14 +87,11 @@ def main(args: argparse.Namespace) -> None: assert not (args.no_pytest and args.pytest) if args.no_pytest: apps_for_build = [app for app in apps if not (_is_pytest_app(app, PYTEST_APPS) - or _is_pytest_app(app, GATEWAY_APPS) - or _is_pytest_app(app, HOST_APPS))] + or _is_pytest_app(app, GATEWAY_APPS))] elif args.pytest: apps_for_build = [app for app in apps if _is_pytest_app(app, PYTEST_APPS)] elif args.rcp_gateway: apps_for_build = [app for app in apps if _is_pytest_app(app, GATEWAY_APPS)] - elif args.host: - apps_for_build = [app for app in apps if _is_pytest_app(app, HOST_APPS)] else: apps_for_build = apps[:] @@ -178,11 +169,6 @@ def main(args: argparse.Namespace) -> None: action="store_true", help='Only build rcp_gateway pytest apps, defined in GATEWAY_APPS', ) - parser.add_argument( - '--host', - action="store_true", - help='Only build host apps, defined in HOST_APPS', - ) arguments = parser.parse_args() if not arguments.paths: