From 8795d16466e399115b71bdb1ffa2e9aff43a028e Mon Sep 17 00:00:00 2001 From: David Cermak Date: Wed, 18 Sep 2024 17:15:43 +0200 Subject: [PATCH] fix(wifi_remote): Fix CI builds to generate configs per slave selection Rather than keeping sdkconfig.ci.*** for the smoke tests in git --- .github/workflows/wifi_remote__build.yml | 5 +-- .../scripts/generate_slave_configs.py | 32 +++++++++++++++++++ .../components/esp_hosted/CMakeLists.txt | 6 ++-- .../test/smoke_test/main/CMakeLists.txt | 8 +++-- 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 components/esp_wifi_remote/scripts/generate_slave_configs.py diff --git a/.github/workflows/wifi_remote__build.yml b/.github/workflows/wifi_remote__build.yml index a11e2dfe7..9e25e7cb2 100644 --- a/.github/workflows/wifi_remote__build.yml +++ b/.github/workflows/wifi_remote__build.yml @@ -13,7 +13,7 @@ jobs: name: Check API compatibility of WiFi Remote strategy: matrix: - idf_ver: ["latest"] + idf_ver: ["latest", "release-v5.3"] runs-on: ubuntu-20.04 container: espressif/idf:${{ matrix.idf_ver }} steps: @@ -33,7 +33,7 @@ jobs: name: Build WiFi Remote Test strategy: matrix: - idf_ver: ["latest"] + idf_ver: ["latest", "release-v5.3"] test: [ { app: smoke_test, path: "test/smoke_test" }] runs-on: ubuntu-20.04 container: espressif/idf:${{ matrix.idf_ver }} @@ -49,6 +49,7 @@ jobs: run: | . ${IDF_PATH}/export.sh pip install idf-component-manager idf-build-apps --upgrade + python ./scripts/generate_slave_configs.py ./components/esp_wifi_remote/${{matrix.test.path}} python ./ci/build_apps.py ./components/esp_wifi_remote/${{matrix.test.path}} -vv --preserve-all build_wifi_remote_example: diff --git a/components/esp_wifi_remote/scripts/generate_slave_configs.py b/components/esp_wifi_remote/scripts/generate_slave_configs.py new file mode 100644 index 000000000..ab9894ca7 --- /dev/null +++ b/components/esp_wifi_remote/scripts/generate_slave_configs.py @@ -0,0 +1,32 @@ +# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Apache-2.0 +import os +import re +import sys + +if len(sys.argv) < 2: + print('Usage: python generate_slave_configs.py ') + sys.exit(1) +output_directory = sys.argv[1] + +# Input Kconfig file +kconfig_file = f"idf_v{os.getenv('ESP_IDF_VERSION')}/Kconfig.slave_select.in" + +# Output file prefix +output_prefix = 'sdkconfig.ci.' + +# Regex pattern to match all available options for SLAVE_IDF_TARGET +pattern = r'^ *config SLAVE_IDF_TARGET_(\w+)' + +# Read the Kconfig and generate specific sdkconfig.ci.{slave} for each option +with open(kconfig_file, 'r') as file: + for line in file: + match = re.match(pattern, line) + if match: + slave = match.group(1) + output_file = os.path.join(output_directory, f'{output_prefix}{slave.lower()}') + + with open(output_file, 'w') as out_file: + out_file.write(f'CONFIG_SLAVE_IDF_TARGET_{slave.upper()}=y\n') + + print(f'Generated: {output_file}') diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/CMakeLists.txt b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/CMakeLists.txt index e49536173..f37c59bd1 100644 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/CMakeLists.txt +++ b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/CMakeLists.txt @@ -1,3 +1,5 @@ -idf_component_register(SRCS "esp_hosted_mock.c" - INCLUDE_DIRS "include" +set(IDF_VER_DIR "idf_v$ENV{ESP_IDF_VERSION}") + +idf_component_register(SRCS "${IDF_VER_DIR}/esp_hosted_mock.c" + INCLUDE_DIRS "${IDF_VER_DIR}/include" "include" REQUIRES esp_wifi esp_wifi_remote) diff --git a/components/esp_wifi_remote/test/smoke_test/main/CMakeLists.txt b/components/esp_wifi_remote/test/smoke_test/main/CMakeLists.txt index 00a81f853..fb72d4a0a 100644 --- a/components/esp_wifi_remote/test/smoke_test/main/CMakeLists.txt +++ b/components/esp_wifi_remote/test/smoke_test/main/CMakeLists.txt @@ -1,2 +1,6 @@ -idf_component_register(SRCS "smoke_test.c" "all_wifi_calls.c" "all_wifi_remote_calls.c" - INCLUDE_DIRS ".") +set(IDF_VER_DIR "idf_v$ENV{ESP_IDF_VERSION}") + +idf_component_register(SRCS "smoke_test.c" + "${IDF_VER_DIR}/all_wifi_calls.c" + "${IDF_VER_DIR}/all_wifi_remote_calls.c" + INCLUDE_DIRS ".")