mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-11-04 06:11:06 +00:00 
			
		
		
		
	ci: support diff manifest sha with the base commit
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -102,6 +102,7 @@ pytest_embedded_log/
 | 
				
			|||||||
list_job*.txt
 | 
					list_job*.txt
 | 
				
			||||||
size_info*.txt
 | 
					size_info*.txt
 | 
				
			||||||
XUNIT_RESULT*.xml
 | 
					XUNIT_RESULT*.xml
 | 
				
			||||||
 | 
					.manifest_sha
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# clang config (for LSP)
 | 
					# clang config (for LSP)
 | 
				
			||||||
.clangd
 | 
					.clangd
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -264,6 +264,8 @@ generate_build_child_pipeline:
 | 
				
			|||||||
  dependencies: # set dependencies to null to avoid missing artifacts issue
 | 
					  dependencies: # set dependencies to null to avoid missing artifacts issue
 | 
				
			||||||
  needs:
 | 
					  needs:
 | 
				
			||||||
    - pipeline_variables
 | 
					    - pipeline_variables
 | 
				
			||||||
 | 
					    - job: baseline_manifest_sha
 | 
				
			||||||
 | 
					      optional: true
 | 
				
			||||||
  artifacts:
 | 
					  artifacts:
 | 
				
			||||||
    paths:
 | 
					    paths:
 | 
				
			||||||
      - build_child_pipeline.yml
 | 
					      - build_child_pipeline.yml
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -169,3 +169,23 @@ pipeline_variables:
 | 
				
			|||||||
      - pipeline.env
 | 
					      - pipeline.env
 | 
				
			||||||
    expire_in: 1 week
 | 
					    expire_in: 1 week
 | 
				
			||||||
    when: always
 | 
					    when: always
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					baseline_manifest_sha:
 | 
				
			||||||
 | 
					  extends:
 | 
				
			||||||
 | 
					    - .pre_check_template
 | 
				
			||||||
 | 
					    - .rules:dev-push
 | 
				
			||||||
 | 
					  tags: [fast_run, shiny]
 | 
				
			||||||
 | 
					  script:
 | 
				
			||||||
 | 
					    - |
 | 
				
			||||||
 | 
					      if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then
 | 
				
			||||||
 | 
					        git fetch origin $CI_MERGE_REQUEST_DIFF_BASE_SHA --depth=1
 | 
				
			||||||
 | 
					        git checkout FETCH_HEAD
 | 
				
			||||||
 | 
					        idf-build-apps dump-manifest-sha \
 | 
				
			||||||
 | 
					          --manifest-files $(find . -name ".build-test-rules.yml" | xargs) \
 | 
				
			||||||
 | 
					          --output .manifest_sha
 | 
				
			||||||
 | 
					      fi
 | 
				
			||||||
 | 
					  artifacts:
 | 
				
			||||||
 | 
					    paths:
 | 
				
			||||||
 | 
					      - .manifest_sha
 | 
				
			||||||
 | 
					    expire_in: 1 week
 | 
				
			||||||
 | 
					    when: always
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -217,6 +217,10 @@
 | 
				
			|||||||
  rules:
 | 
					  rules:
 | 
				
			||||||
    - <<: *if-tag-release
 | 
					    - <<: *if-tag-release
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.rules:dev-push:
 | 
				
			||||||
 | 
					  rules:
 | 
				
			||||||
 | 
					    - <<: *if-dev-push
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Do not upload caches on dev branches by default
 | 
					# Do not upload caches on dev branches by default
 | 
				
			||||||
.rules:upload-python-cache:
 | 
					.rules:upload-python-cache:
 | 
				
			||||||
  rules:
 | 
					  rules:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -89,6 +89,7 @@ def main(arguments: argparse.Namespace) -> None:
 | 
				
			|||||||
            marker_expr='not host_test',
 | 
					            marker_expr='not host_test',
 | 
				
			||||||
            config_rules_str=DEFAULT_CONFIG_RULES_STR,
 | 
					            config_rules_str=DEFAULT_CONFIG_RULES_STR,
 | 
				
			||||||
            extra_default_build_targets=extra_default_build_targets,
 | 
					            extra_default_build_targets=extra_default_build_targets,
 | 
				
			||||||
 | 
					            compare_manifest_sha_filepath=arguments.compare_manifest_sha_filepath,
 | 
				
			||||||
            modified_components=arguments.modified_components,
 | 
					            modified_components=arguments.modified_components,
 | 
				
			||||||
            modified_files=arguments.modified_files,
 | 
					            modified_files=arguments.modified_files,
 | 
				
			||||||
            ignore_app_dependencies_filepatterns=arguments.ignore_app_dependencies_filepatterns,
 | 
					            ignore_app_dependencies_filepatterns=arguments.ignore_app_dependencies_filepatterns,
 | 
				
			||||||
@@ -165,6 +166,11 @@ if __name__ == '__main__':
 | 
				
			|||||||
        default=os.path.join(IDF_PATH, '.gitlab', 'ci', 'default-build-test-rules.yml'),
 | 
					        default=os.path.join(IDF_PATH, '.gitlab', 'ci', 'default-build-test-rules.yml'),
 | 
				
			||||||
        help='default build test rules config file',
 | 
					        help='default build test rules config file',
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					    parser.add_argument(
 | 
				
			||||||
 | 
					        '--compare-manifest-sha-filepath',
 | 
				
			||||||
 | 
					        default=os.path.join(IDF_PATH, '.manifest_sha'),
 | 
				
			||||||
 | 
					        help='Path to the recorded manifest sha file generated by `idf-build-apps dump-manifest-sha`'
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    parser.add_argument(
 | 
					    parser.add_argument(
 | 
				
			||||||
        '--modified-components',
 | 
					        '--modified-components',
 | 
				
			||||||
        type=_separate_str_to_list,
 | 
					        type=_separate_str_to_list,
 | 
				
			||||||
@@ -237,4 +243,8 @@ if __name__ == '__main__':
 | 
				
			|||||||
            # setting default values
 | 
					            # setting default values
 | 
				
			||||||
            args.ignore_app_dependencies_filepatterns = DEFAULT_FULL_BUILD_TEST_FILEPATTERNS
 | 
					            args.ignore_app_dependencies_filepatterns = DEFAULT_FULL_BUILD_TEST_FILEPATTERNS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if not os.path.isfile(args.compare_manifest_sha_filepath):
 | 
				
			||||||
 | 
					        # ignore if the file does not exist
 | 
				
			||||||
 | 
					        args.compare_manifest_sha_filepath = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    main(args)
 | 
					    main(args)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -128,6 +128,7 @@ def get_all_apps(
 | 
				
			|||||||
    config_rules_str: t.Optional[t.List[str]] = None,
 | 
					    config_rules_str: t.Optional[t.List[str]] = None,
 | 
				
			||||||
    preserve_all: bool = False,
 | 
					    preserve_all: bool = False,
 | 
				
			||||||
    extra_default_build_targets: t.Optional[t.List[str]] = None,
 | 
					    extra_default_build_targets: t.Optional[t.List[str]] = None,
 | 
				
			||||||
 | 
					    compare_manifest_sha_filepath: t.Optional[str] = None,
 | 
				
			||||||
    modified_components: t.Optional[t.List[str]] = None,
 | 
					    modified_components: t.Optional[t.List[str]] = None,
 | 
				
			||||||
    modified_files: t.Optional[t.List[str]] = None,
 | 
					    modified_files: t.Optional[t.List[str]] = None,
 | 
				
			||||||
    ignore_app_dependencies_filepatterns: t.Optional[t.List[str]] = None,
 | 
					    ignore_app_dependencies_filepatterns: t.Optional[t.List[str]] = None,
 | 
				
			||||||
@@ -142,8 +143,10 @@ def get_all_apps(
 | 
				
			|||||||
    :param config_rules_str: config rules string
 | 
					    :param config_rules_str: config rules string
 | 
				
			||||||
    :param preserve_all: preserve all apps
 | 
					    :param preserve_all: preserve all apps
 | 
				
			||||||
    :param extra_default_build_targets: extra default build targets
 | 
					    :param extra_default_build_targets: extra default build targets
 | 
				
			||||||
 | 
					    :param compare_manifest_sha_filepath: check manifest sha filepath
 | 
				
			||||||
    :param modified_components: modified components
 | 
					    :param modified_components: modified components
 | 
				
			||||||
    :param modified_files: modified files
 | 
					    :param modified_files: modified files
 | 
				
			||||||
 | 
					    :param ignore_app_dependencies_components: ignore app dependencies components
 | 
				
			||||||
    :param ignore_app_dependencies_filepatterns: ignore app dependencies filepatterns
 | 
					    :param ignore_app_dependencies_filepatterns: ignore app dependencies filepatterns
 | 
				
			||||||
    :return: tuple of test-required apps and non-test-related apps
 | 
					    :return: tuple of test-required apps and non-test-related apps
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
@@ -161,6 +164,7 @@ def get_all_apps(
 | 
				
			|||||||
            size_json_filename='size.json',
 | 
					            size_json_filename='size.json',
 | 
				
			||||||
            check_warnings=True,
 | 
					            check_warnings=True,
 | 
				
			||||||
            manifest_rootpath=IDF_PATH,
 | 
					            manifest_rootpath=IDF_PATH,
 | 
				
			||||||
 | 
					            compare_manifest_sha_filepath=compare_manifest_sha_filepath,
 | 
				
			||||||
            manifest_files=get_all_manifest_files(),
 | 
					            manifest_files=get_all_manifest_files(),
 | 
				
			||||||
            default_build_targets=SUPPORTED_TARGETS + (extra_default_build_targets or []),
 | 
					            default_build_targets=SUPPORTED_TARGETS + (extra_default_build_targets or []),
 | 
				
			||||||
            modified_components=modified_components,
 | 
					            modified_components=modified_components,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user