ci: ensure binary size artifacts are uploaded in Build Stage Child pipeline via artifacts_handler script.

- Updated dynamic pipeline to include artifact upload commands for size reports, allowing easier parsing on the CI dashboard.
- Each job now handles its own size.json file, ensuring independent access for better CI artifact management.
This commit is contained in:
Aleksei Apaseev 2024-09-18 11:16:04 +08:00
parent 794cf2ea0e
commit 397fdb56fb
5 changed files with 8 additions and 6 deletions

View File

@ -66,7 +66,7 @@ if __name__ == '__main__':
check_app_dependencies=True, check_app_dependencies=True,
parallel_count=args.parallel_count, parallel_count=args.parallel_count,
parallel_index=args.parallel_index, parallel_index=args.parallel_index,
collect_size_info='size_info_@p.txt', collect_size_info='size_info.txt',
collect_app_info=args.collect_app_info, collect_app_info=args.collect_app_info,
junitxml=args.junitxml, junitxml=args.junitxml,
copy_sdkconfig=True, copy_sdkconfig=True,

View File

@ -37,6 +37,7 @@
--collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt" --collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt"
--modified-components ${MR_MODIFIED_COMPONENTS} --modified-components ${MR_MODIFIED_COMPONENTS}
--junitxml "build_summary_${CI_JOB_NAME_SLUG}.xml" --junitxml "build_summary_${CI_JOB_NAME_SLUG}.xml"
- run_cmd python tools/ci/artifacts_handler.py upload --type size_reports
.dynamic_target_test_template: .dynamic_target_test_template:
extends: extends:

View File

@ -16,6 +16,7 @@ from idf_build_apps import App
from idf_build_apps.utils import rmdir from idf_build_apps.utils import rmdir
from idf_ci_utils import IDF_PATH from idf_ci_utils import IDF_PATH
from idf_pytest.constants import DEFAULT_BUILD_LOG_FILENAME from idf_pytest.constants import DEFAULT_BUILD_LOG_FILENAME
from idf_pytest.constants import DEFAULT_SIZE_JSON_FILENAME
class AppDownloader: class AppDownloader:
@ -60,9 +61,6 @@ class AppUploader(AppDownloader):
ArtifactType.LOGS: [ ArtifactType.LOGS: [
DEFAULT_BUILD_LOG_FILENAME, DEFAULT_BUILD_LOG_FILENAME,
], ],
ArtifactType.SIZE_REPORTS: [
'size.json',
],
} }
def __init__(self, pipeline_id: t.Union[str, int, None] = None) -> None: def __init__(self, pipeline_id: t.Union[str, int, None] = None) -> None:
@ -108,12 +106,13 @@ class AppUploader(AppDownloader):
else: else:
upload_types = [artifact_type] upload_types = [artifact_type]
# Upload of size.json files is handled by GitLab CI via "artifacts_handler.py" script.
print(f'Uploading {app_build_path} {[k.value for k in upload_types]} to minio server') print(f'Uploading {app_build_path} {[k.value for k in upload_types]} to minio server')
for upload_type in upload_types: for upload_type in upload_types:
uploaded |= self._upload_app(app_build_path, upload_type) uploaded |= self._upload_app(app_build_path, upload_type)
if uploaded: if uploaded:
rmdir(app_build_path, exclude_file_patterns=DEFAULT_BUILD_LOG_FILENAME) rmdir(app_build_path, exclude_file_patterns=[DEFAULT_BUILD_LOG_FILENAME, DEFAULT_SIZE_JSON_FILENAME])
def _download_app(self, app_build_path: str, artifact_type: ArtifactType) -> None: def _download_app(self, app_build_path: str, artifact_type: ArtifactType) -> None:
app_path, build_dir = os.path.split(app_build_path) app_path, build_dir = os.path.split(app_build_path)

View File

@ -153,6 +153,7 @@ DEFAULT_FULL_BUILD_TEST_FILEPATTERNS = [
'tools/ci/ignore_build_warnings.txt', 'tools/ci/ignore_build_warnings.txt',
] ]
DEFAULT_BUILD_LOG_FILENAME = 'build_log.txt' DEFAULT_BUILD_LOG_FILENAME = 'build_log.txt'
DEFAULT_SIZE_JSON_FILENAME = 'size.json'
class CollectMode(str, Enum): class CollectMode(str, Enum):

View File

@ -25,6 +25,7 @@ from idf_py_actions.constants import SUPPORTED_TARGETS as TOOLS_SUPPORTED_TARGET
from .constants import CollectMode from .constants import CollectMode
from .constants import DEFAULT_BUILD_LOG_FILENAME from .constants import DEFAULT_BUILD_LOG_FILENAME
from .constants import DEFAULT_CONFIG_RULES_STR from .constants import DEFAULT_CONFIG_RULES_STR
from .constants import DEFAULT_SIZE_JSON_FILENAME
from .constants import PytestCase from .constants import PytestCase
from .plugin import IdfPytestEmbedded from .plugin import IdfPytestEmbedded
@ -162,7 +163,7 @@ def get_all_apps(
build_dir='build_@t_@w', build_dir='build_@t_@w',
config_rules_str=config_rules_str or DEFAULT_CONFIG_RULES_STR, config_rules_str=config_rules_str or DEFAULT_CONFIG_RULES_STR,
build_log_filename=DEFAULT_BUILD_LOG_FILENAME, build_log_filename=DEFAULT_BUILD_LOG_FILENAME,
size_json_filename='size.json', size_json_filename=DEFAULT_SIZE_JSON_FILENAME,
check_warnings=True, check_warnings=True,
manifest_rootpath=IDF_PATH, manifest_rootpath=IDF_PATH,
compare_manifest_sha_filepath=compare_manifest_sha_filepath, compare_manifest_sha_filepath=compare_manifest_sha_filepath,