Skip to content

Commit 43b3730

Browse files
committed
Merge branch 'ci/diff_manifest' into 'master'
CI: Diff manifest Closes RDT-552 See merge request espressif/esp-idf!33126
2 parents 9cf892a + 56f8b71 commit 43b3730

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ pytest_embedded_log/
102102
list_job*.txt
103103
size_info*.txt
104104
XUNIT_RESULT*.xml
105+
.manifest_sha
105106

106107
# clang config (for LSP)
107108
.clangd

.gitlab/ci/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ generate_build_child_pipeline:
300300
dependencies: # set dependencies to null to avoid missing artifacts issue
301301
needs:
302302
- pipeline_variables
303+
- job: baseline_manifest_sha
304+
optional: true
303305
artifacts:
304306
paths:
305307
- build_child_pipeline.yml

.gitlab/ci/pre_check.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,26 @@ pipeline_variables:
169169
expire_in: 1 week
170170
when: always
171171

172+
baseline_manifest_sha:
173+
extends:
174+
- .pre_check_template
175+
- .rules:dev-push
176+
tags: [fast_run, shiny]
177+
script:
178+
- |
179+
if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then
180+
git fetch origin $CI_MERGE_REQUEST_DIFF_BASE_SHA --depth=1
181+
git checkout FETCH_HEAD
182+
idf-build-apps dump-manifest-sha \
183+
--manifest-files $(find . -name ".build-test-rules.yml" | xargs) \
184+
--output .manifest_sha
185+
fi
186+
artifacts:
187+
paths:
188+
- .manifest_sha
189+
expire_in: 1 week
190+
when: always
191+
172192
redundant_pass_job:
173193
stage: pre_check
174194
tags: [shiny, fast_run]

tools/ci/dynamic_pipelines/scripts/generate_build_child_pipeline.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def main(arguments: argparse.Namespace) -> None:
9090
marker_expr='not host_test',
9191
config_rules_str=DEFAULT_CONFIG_RULES_STR,
9292
extra_default_build_targets=extra_default_build_targets,
93+
compare_manifest_sha_filepath=arguments.compare_manifest_sha_filepath,
9394
modified_components=arguments.modified_components,
9495
modified_files=arguments.modified_files,
9596
ignore_app_dependencies_components=arguments.ignore_app_dependencies_components,
@@ -167,6 +168,11 @@ def main(arguments: argparse.Namespace) -> None:
167168
default=os.path.join(IDF_PATH, '.gitlab', 'ci', 'default-build-test-rules.yml'),
168169
help='default build test rules config file',
169170
)
171+
parser.add_argument(
172+
'--compare-manifest-sha-filepath',
173+
default=os.path.join(IDF_PATH, '.manifest_sha'),
174+
help='Path to the recorded manifest sha file generated by `idf-build-apps dump-manifest-sha`'
175+
)
170176
parser.add_argument(
171177
'--modified-components',
172178
type=_separate_str_to_list,
@@ -244,4 +250,8 @@ def main(arguments: argparse.Namespace) -> None:
244250
# setting default values
245251
args.ignore_app_dependencies_filepatterns = DEFAULT_FULL_BUILD_TEST_FILEPATTERNS
246252

253+
if not os.path.isfile(args.compare_manifest_sha_filepath):
254+
# ignore if the file does not exist
255+
args.compare_manifest_sha_filepath = None
256+
247257
main(args)

tools/ci/idf_pytest/script.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def get_all_apps(
128128
config_rules_str: t.Optional[t.List[str]] = None,
129129
preserve_all: bool = False,
130130
extra_default_build_targets: t.Optional[t.List[str]] = None,
131+
compare_manifest_sha_filepath: t.Optional[str] = None,
131132
modified_components: t.Optional[t.List[str]] = None,
132133
modified_files: t.Optional[t.List[str]] = None,
133134
ignore_app_dependencies_components: t.Optional[t.List[str]] = None,
@@ -143,8 +144,10 @@ def get_all_apps(
143144
:param config_rules_str: config rules string
144145
:param preserve_all: preserve all apps
145146
:param extra_default_build_targets: extra default build targets
147+
:param compare_manifest_sha_filepath: check manifest sha filepath
146148
:param modified_components: modified components
147149
:param modified_files: modified files
150+
:param ignore_app_dependencies_components: ignore app dependencies components
148151
:param ignore_app_dependencies_filepatterns: ignore app dependencies filepatterns
149152
:return: tuple of test-required apps and non-test-related apps
150153
"""
@@ -162,6 +165,7 @@ def get_all_apps(
162165
size_json_filename='size.json',
163166
check_warnings=True,
164167
manifest_rootpath=IDF_PATH,
168+
compare_manifest_sha_filepath=compare_manifest_sha_filepath,
165169
manifest_files=get_all_manifest_files(),
166170
default_build_targets=SUPPORTED_TARGETS + (extra_default_build_targets or []),
167171
modified_components=modified_components,

0 commit comments

Comments
 (0)