ci: fix missing argument ignore_app_dependencies_components

This commit is contained in:
Fu Hanxi 2024-07-24 14:58:50 +02:00
parent 5c3964c9ea
commit aee189253a
No known key found for this signature in database
GPG Key ID: 19399699CF3C4B16
3 changed files with 39 additions and 7 deletions

View File

@ -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,14 +260,24 @@ 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:
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)

View File

@ -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(

View File

@ -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,
))