From aee189253accb444e2ed47647023aa86e1054dea Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Wed, 24 Jul 2024 14:58:50 +0200 Subject: [PATCH 1/2] ci: fix missing argument `ignore_app_dependencies_components` --- tools/ci/ci_build_apps.py | 41 +++++++++++++++---- .../scripts/generate_build_child_pipeline.py | 3 ++ tools/ci/idf_pytest/script.py | 2 + 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/tools/ci/ci_build_apps.py b/tools/ci/ci_build_apps.py index 001abc8696..67c82f8938 100644 --- a/tools/ci/ci_build_apps.py +++ b/tools/ci/ci_build_apps.py @@ -17,6 +17,7 @@ from idf_build_apps import setup_logging from idf_build_apps.utils import semicolon_separated_str_to_list from idf_pytest.constants import DEFAULT_BUILD_TEST_RULES_FILEPATH from idf_pytest.constants import DEFAULT_CONFIG_RULES_STR +from idf_pytest.constants import DEFAULT_FULL_BUILD_TEST_COMPONENTS from idf_pytest.constants import DEFAULT_FULL_BUILD_TEST_FILEPATTERNS from idf_pytest.constants import DEFAULT_IGNORE_WARNING_FILEPATH from idf_pytest.script import get_all_apps @@ -50,6 +51,7 @@ def main(args: argparse.Namespace) -> None: extra_default_build_targets=extra_default_build_targets, modified_files=args.modified_files, modified_components=args.modified_components, + ignore_app_dependencies_components=args.ignore_app_dependencies_components, ignore_app_dependencies_filepatterns=args.ignore_app_dependencies_filepatterns, ) @@ -82,6 +84,7 @@ def main(args: argparse.Namespace) -> None: copy_sdkconfig=args.copy_sdkconfig, modified_components=args.modified_components, modified_files=args.modified_files, + ignore_app_dependencies_components=args.ignore_app_dependencies_components, ignore_app_dependencies_filepatterns=args.ignore_app_dependencies_filepatterns, junitxml=args.junitxml, ) @@ -195,6 +198,7 @@ if __name__ == '__main__': parser.add_argument( '--modified-components', type=semicolon_separated_str_to_list, + default=os.getenv('MR_MODIFIED_COMPONENTS'), help='semicolon-separated string which specifies the modified components. ' 'app with `depends_components` set in the corresponding manifest files would only be built ' 'if depends on any of the specified components. ' @@ -204,20 +208,33 @@ if __name__ == '__main__': parser.add_argument( '--modified-files', type=semicolon_separated_str_to_list, + default=os.getenv('MR_MODIFIED_FILES'), help='semicolon-separated string which specifies the modified files. ' 'app with `depends_filepatterns` set in the corresponding manifest files would only be built ' 'if any of the specified file pattern matches any of the specified modified files. ' 'If set to "", the value would be considered as None. ' 'If set to ";", the value would be considered as an empty list', ) + parser.add_argument( + '-ic', + '--ignore-app-dependencies-components', + type=semicolon_separated_str_to_list, + help='semicolon-separated string which specifies the modified components used for ' + 'ignoring checking the app dependencies. ' + 'The `depends_components` and `depends_filepatterns` set in the manifest files will be ignored ' + 'when any of the specified components matches any of the modified components. ' + 'Must be used together with --modified-components. ' + 'If set to "", the value would be considered as None. ' + 'If set to ";", the value would be considered as an empty list', + ) parser.add_argument( '-if', '--ignore-app-dependencies-filepatterns', type=semicolon_separated_str_to_list, help='semicolon-separated string which specifies the file patterns used for ' 'ignoring checking the app dependencies. ' - 'The `depends_components` and `depends_filepatterns` set in the manifest files ' - 'will be ignored when any of the specified file patterns matches any of the modified files. ' + 'The `depends_components` and `depends_filepatterns` set in the manifest files will be ignored ' + 'when any of the specified file patterns matches any of the modified files. ' 'Must be used together with --modified-files. ' 'If set to "", the value would be considered as None. ' 'If set to ";", the value would be considered as an empty list', @@ -243,15 +260,25 @@ if __name__ == '__main__': print(f'env var {_k} set to "{_v}"') if os.getenv('IS_MR_PIPELINE') == '0' or os.getenv('BUILD_AND_TEST_ALL_APPS') == '1': - # if it's not MR pipeline or env var BUILD_AND_TEST_ALL_APPS=1, - # remove component dependency related arguments + print('Build and run all test cases, and compile all cmake apps') arguments.modified_components = None arguments.modified_files = None + arguments.ignore_app_dependencies_components = None arguments.ignore_app_dependencies_filepatterns = None + else: + print( + f'Build and run only test cases matching:\n' + f'- modified components: {arguments.modified_components}\n' + f'- modified files: {arguments.modified_files}' + ) - # default file patterns to trigger full build - if arguments.modified_files is not None and arguments.ignore_app_dependencies_filepatterns is None: - arguments.ignore_app_dependencies_filepatterns = DEFAULT_FULL_BUILD_TEST_FILEPATTERNS + if arguments.modified_components is not None and not arguments.ignore_app_dependencies_components: + # setting default values + arguments.ignore_app_dependencies_components = DEFAULT_FULL_BUILD_TEST_COMPONENTS + + if arguments.modified_files is not None and not arguments.ignore_app_dependencies_filepatterns: + # setting default values + arguments.ignore_app_dependencies_filepatterns = DEFAULT_FULL_BUILD_TEST_FILEPATTERNS main(arguments) diff --git a/tools/ci/dynamic_pipelines/scripts/generate_build_child_pipeline.py b/tools/ci/dynamic_pipelines/scripts/generate_build_child_pipeline.py index 7c8bf1d4d1..9994df83c8 100644 --- a/tools/ci/dynamic_pipelines/scripts/generate_build_child_pipeline.py +++ b/tools/ci/dynamic_pipelines/scripts/generate_build_child_pipeline.py @@ -91,6 +91,7 @@ def main(arguments: argparse.Namespace) -> None: extra_default_build_targets=extra_default_build_targets, modified_components=arguments.modified_components, modified_files=arguments.modified_files, + ignore_app_dependencies_components=arguments.ignore_app_dependencies_components, ignore_app_dependencies_filepatterns=arguments.ignore_app_dependencies_filepatterns, ) @@ -216,11 +217,13 @@ if __name__ == '__main__': print('Build and run all test cases, and compile all cmake apps') args.modified_components = None args.modified_files = None + args.ignore_app_dependencies_components = None args.ignore_app_dependencies_filepatterns = None elif args.filter_expr is not None: print('Build and run only test cases matching "%s"' % args.filter_expr) args.modified_components = None args.modified_files = None + args.ignore_app_dependencies_components = None args.ignore_app_dependencies_filepatterns = None else: print( diff --git a/tools/ci/idf_pytest/script.py b/tools/ci/idf_pytest/script.py index eed0609e0f..199fe7b03f 100644 --- a/tools/ci/idf_pytest/script.py +++ b/tools/ci/idf_pytest/script.py @@ -130,6 +130,7 @@ def get_all_apps( extra_default_build_targets: t.Optional[t.List[str]] = None, modified_components: t.Optional[t.List[str]] = None, modified_files: t.Optional[t.List[str]] = None, + ignore_app_dependencies_components: t.Optional[t.List[str]] = None, ignore_app_dependencies_filepatterns: t.Optional[t.List[str]] = None, ) -> t.Tuple[t.Set[App], t.Set[App]]: """ @@ -165,6 +166,7 @@ def get_all_apps( default_build_targets=SUPPORTED_TARGETS + (extra_default_build_targets or []), modified_components=modified_components, modified_files=modified_files, + ignore_app_dependencies_components=ignore_app_dependencies_components, ignore_app_dependencies_filepatterns=ignore_app_dependencies_filepatterns, include_skipped_apps=True, )) From 104ba56d92f74de6eaf5944b863293116ce22fd9 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Wed, 24 Jul 2024 21:18:19 +0200 Subject: [PATCH 2/2] ci: temp disable esp32c5 build of examples/bluetooth/nimble/throughput_app/blecent_throughput --- examples/bluetooth/.build-test-rules.yml | 15 +++++++++++++++ .../throughput_app/blecent_throughput/README.md | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/examples/bluetooth/.build-test-rules.yml b/examples/bluetooth/.build-test-rules.yml index d10041e415..2bbfcb02a3 100644 --- a/examples/bluetooth/.build-test-rules.yml +++ b/examples/bluetooth/.build-test-rules.yml @@ -267,3 +267,18 @@ examples/bluetooth/nimble/throughput_app: depends_filepatterns: - examples/bluetooth/nimble/common/**/* - examples/bluetooth/nimble/throughput_app/blecent_throughput/components/**/* + +# Remove this special case for esp32c5 after IDF-8638 +examples/bluetooth/nimble/throughput_app/blecent_throughput: + <<: *bt_default_depends + disable: + - if: SOC_BLE_SUPPORTED != 1 + - if: IDF_TARGET == "esp32c5" + temporary: true + reason: c5 build failed. Fix in IDF-8638 + depends_components: + - esp_driver_gpio + - esp_driver_uart + depends_filepatterns: + - examples/bluetooth/nimble/common/**/* + - examples/bluetooth/nimble/throughput_app/blecent_throughput/components/**/* diff --git a/examples/bluetooth/nimble/throughput_app/blecent_throughput/README.md b/examples/bluetooth/nimble/throughput_app/blecent_throughput/README.md index f240e94c69..28ed48e0fe 100644 --- a/examples/bluetooth/nimble/throughput_app/blecent_throughput/README.md +++ b/examples/bluetooth/nimble/throughput_app/blecent_throughput/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | # Throughput blecent Example