Skip to content

Commit 803a288

Browse files
alekseiapahfudev
authored andcommitted
ci: enhance the Dynamic pipeline report with binary size information
1 parent e8d96c7 commit 803a288

File tree

10 files changed

+1115
-133
lines changed

10 files changed

+1115
-133
lines changed

tools/ci/dynamic_pipelines/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
REPORT_TEMPLATE_FILEPATH = os.path.join(
3535
IDF_PATH, 'tools', 'ci', 'dynamic_pipelines', 'templates', 'report.template.html'
3636
)
37+
TOP_N_APPS_BY_SIZE_DIFF = 10
38+
SIZE_DIFFERENCE_BYTES_THRESHOLD = 500
39+
BINARY_SIZE_METRIC_NAME = 'binary_size'
3740

3841
RETRY_JOB_PICTURE_PATH = 'tools/ci/dynamic_pipelines/templates/retry-jobs.png'
3942
RETRY_JOB_TITLE = '\n\nRetry failed jobs with with help of "retry_failed_jobs" stage of the pipeline:'

tools/ci/dynamic_pipelines/report.py

Lines changed: 357 additions & 125 deletions
Large diffs are not rendered by default.

tools/ci/dynamic_pipelines/scripts/generate_report.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
1+
# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
22
# SPDX-License-Identifier: Apache-2.0
33
import argparse
44
import glob
@@ -9,8 +9,10 @@
99
from dynamic_pipelines.report import BuildReportGenerator
1010
from dynamic_pipelines.report import JobReportGenerator
1111
from dynamic_pipelines.report import TargetTestReportGenerator
12+
from dynamic_pipelines.utils import fetch_app_metrics
1213
from dynamic_pipelines.utils import fetch_failed_jobs
1314
from dynamic_pipelines.utils import parse_testcases_from_filepattern
15+
from idf_ci.app import enrich_apps_with_metrics_info
1416
from idf_ci.app import import_apps_from_txt
1517

1618

@@ -73,6 +75,11 @@ def generate_build_report(args: argparse.Namespace) -> None:
7375
apps: t.List[t.Any] = [
7476
app for file_name in glob.glob(args.app_list_filepattern) for app in import_apps_from_txt(file_name)
7577
]
78+
app_metrics = fetch_app_metrics(
79+
source_commit_sha=os.environ.get('CI_COMMIT_SHA'),
80+
target_commit_sha=os.environ.get('CI_MERGE_REQUEST_TARGET_BRANCH_SHA'),
81+
)
82+
apps = enrich_apps_with_metrics_info(app_metrics, apps)
7683
report_generator = BuildReportGenerator(
7784
args.project_id, args.mr_iid, args.pipeline_id, args.job_id, args.commit_id, apps=apps
7885
)
@@ -84,7 +91,7 @@ def generate_target_test_report(args: argparse.Namespace) -> None:
8491
report_generator = TargetTestReportGenerator(
8592
args.project_id, args.mr_iid, args.pipeline_id, args.job_id, args.commit_id, test_cases=test_cases
8693
)
87-
report_generator.post_report(print_report_path=False)
94+
report_generator.post_report()
8895

8996

9097
def generate_jobs_report(args: argparse.Namespace) -> None:
@@ -93,8 +100,10 @@ def generate_jobs_report(args: argparse.Namespace) -> None:
93100
if not jobs:
94101
return
95102

96-
report_generator = JobReportGenerator(args.project_id, args.mr_iid, args.pipeline_id, args.job_id, args.commit_id, jobs=jobs)
97-
report_generator.post_report(print_report_path=False, print_retry_jobs_message=any(job.is_failed for job in jobs))
103+
report_generator = JobReportGenerator(
104+
args.project_id, args.mr_iid, args.pipeline_id, args.job_id, args.commit_id, jobs=jobs
105+
)
106+
report_generator.post_report(print_retry_jobs_message=any(job.is_failed for job in jobs))
98107

99108

100109
if __name__ == '__main__':

tools/ci/dynamic_pipelines/templates/test_child_pipeline.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ generate_pytest_build_report:
77
when: always
88
artifacts:
99
paths:
10+
- failed_apps.html
11+
- built_apps.html
12+
- skipped_apps.html
1013
- build_report.html
1114
- test_related_apps_download_urls.yml
1215
expire_in: 1 week
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{"build_system": "idf_cmake", "app_dir": "tools/test_apps/system/panic", "target": "esp32s3", "sdkconfig_path": "/builds/espressif/esp-idf/tools/test_apps/system/panic/sdkconfig.ci.coredump_flash_capture_dram", "config_name": "coredump_flash_capture_dram", "sdkconfig_defaults_str": null, "dry_run": false, "verbose": false, "check_warnings": true, "preserve": false, "copy_sdkconfig": false, "index": null, "build_status": "build failed", "build_comment": "Compilation error", "cmake_vars": {}, "work_dir": "tools/test_apps/system/panic", "build_dir": "build_esp32s3_coredump_flash_capture_dram", "build_log_filename": "build_log.txt", "size_json_filename": "size.json"}
2+
{"build_system": "idf_cmake", "app_dir": "tools/test_apps/system/ram_loadable_app", "target": "esp32", "sdkconfig_path": "/builds/espressif/esp-idf/tools/test_apps/system/ram_loadable_app/sdkconfig.ci.defaults", "config_name": "defaults", "sdkconfig_defaults_str": null, "dry_run": false, "verbose": false, "check_warnings": true, "preserve": true, "copy_sdkconfig": false, "index": null, "build_status": "build success", "build_comment": null, "cmake_vars": {}, "work_dir": "tools/test_apps/system/ram_loadable_app", "build_dir": "build_esp32_defaults", "build_log_filename": "build_log.txt", "size_json_filename": "size.json"}
3+
{"build_system": "idf_cmake", "app_dir": "tools/test_apps/system/ram_loadable_app", "target": "esp32", "sdkconfig_path": "/builds/espressif/esp-idf/tools/test_apps/system/ram_loadable_app/sdkconfig.ci.pure_ram", "config_name": "pure_ram", "sdkconfig_defaults_str": null, "dry_run": false, "verbose": false, "check_warnings": true, "preserve": true, "copy_sdkconfig": false, "index": null, "build_status": "build success", "build_comment": null, "cmake_vars": {}, "work_dir": "tools/test_apps/system/ram_loadable_app", "build_dir": "build_esp32_pure_ram", "build_log_filename": "build_log.txt", "size_json_filename": "size.json"}
4+
{"build_system": "idf_cmake", "app_dir": "tools/test_apps/system/startup", "target": "esp32", "sdkconfig_path": "/builds/espressif/esp-idf/tools/test_apps/system/startup/sdkconfig.ci.flash_80m_qio", "config_name": "flash_80m_qio", "sdkconfig_defaults_str": null, "dry_run": false, "verbose": false, "check_warnings": true, "preserve": true, "copy_sdkconfig": false, "index": null, "build_status": "build success", "build_comment": null, "cmake_vars": {}, "work_dir": "tools/test_apps/system/startup", "build_dir": "build_esp32_flash_80m_qio", "build_log_filename": "build_log.txt", "size_json_filename": "size.json"}
5+
{"build_system": "idf_cmake", "app_dir": "tools/test_apps/system/startup", "target": "esp32s3", "sdkconfig_path": "/builds/espressif/esp-idf/tools/test_apps/system/startup/sdkconfig.ci.stack_check_verbose_log", "config_name": "stack_check_verbose_log", "sdkconfig_defaults_str": null, "dry_run": false, "verbose": false, "check_warnings": true, "preserve": true, "copy_sdkconfig": false, "index": null, "build_status": "build success", "build_comment": null, "cmake_vars": {}, "work_dir": "tools/test_apps/system/startup", "build_dir": "build_esp32s3_stack_check_verbose_log", "build_log_filename": "build_log.txt", "size_json_filename": "size.json"}
6+
{"build_system": "idf_cmake", "app_dir": "tools/test_apps/system/test_watchpoint", "target": "esp32", "sdkconfig_path": null, "config_name": "default", "sdkconfig_defaults_str": null, "dry_run": false, "verbose": false, "check_warnings": true, "preserve": false, "copy_sdkconfig": false, "index": null, "build_status": "skipped", "build_comment": "Skipped due to unmet dependencies", "cmake_vars": {}, "work_dir": "tools/test_apps/system/test_watchpoint", "build_dir": "build_esp32_default", "build_log_filename": "build_log.txt", "size_json_filename": "size.json"}
7+
{"build_system": "idf_cmake", "app_dir": "tools/test_apps/system/test_watchpoint", "target": "esp32c3", "sdkconfig_path": null, "config_name": "default", "sdkconfig_defaults_str": null, "dry_run": false, "verbose": false, "check_warnings": true, "preserve": false, "copy_sdkconfig": false, "index": null, "build_status": "skipped", "build_comment": "Skipped due to unmet dependencies", "cmake_vars": {}, "work_dir": "tools/test_apps/system/test_watchpoint", "build_dir": "build_esp32c3_default", "build_log_filename": "build_log.txt", "size_json_filename": "size.json"}
8+
{"build_system": "idf_cmake", "app_dir": "tools/test_apps/system/unicore_bootloader", "target": "esp32", "sdkconfig_path": "/builds/espressif/esp-idf/tools/test_apps/system/unicore_bootloader/sdkconfig.ci.multicore", "config_name": "multicore", "sdkconfig_defaults_str": null, "dry_run": false, "verbose": false, "check_warnings": true, "preserve": false, "copy_sdkconfig": false, "index": null, "build_status": "build failed", "build_comment": "Compilation error", "cmake_vars": {}, "work_dir": "tools/test_apps/system/unicore_bootloader", "build_dir": "build_esp32_multicore", "build_log_filename": "build_log.txt", "size_json_filename": "size.json"}
9+
{"build_system": "idf_cmake", "app_dir": "tools/test_apps/system/unicore_bootloader", "target": "esp32s3", "sdkconfig_path": "/builds/espressif/esp-idf/tools/test_apps/system/unicore_bootloader/sdkconfig.ci.unicore_psram", "config_name": "unicore_psram", "sdkconfig_defaults_str": null, "dry_run": false, "verbose": false, "check_warnings": true, "preserve": true, "copy_sdkconfig": false, "index": null, "build_status": "build success", "build_comment": null, "cmake_vars": {}, "work_dir": "tools/test_apps/system/unicore_bootloader", "build_dir": "build_esp32s3_unicore_psram", "build_log_filename": "build_log.txt", "size_json_filename": "size.json"}
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{
2+
"tools/test_apps/system/panic_coredump_flash_capture_dram_esp32s3": {
3+
"source_commit_id": "bacfa4aa59a37b70b800f1758106fa5f5af99f16",
4+
"target_commit_id": "36d5d8c31c7d3332b43bd5fe4d40b515c6a71097",
5+
"app_name": "panic",
6+
"config_name": "coredump_flash_capture_dram",
7+
"target": "esp32s3",
8+
"metrics": {
9+
"binary_size": {
10+
"source_value": 156936,
11+
"target_value": 162936,
12+
"difference": 6000,
13+
"difference_percentage": 3.82
14+
}
15+
},
16+
"app_path": "tools/test_apps/system/panic_coredump"
17+
},
18+
"tools/test_apps/system/ram_loadable_app_defaults_esp32": {
19+
"source_commit_id": "bacfa4aa59a37b70b800f1758106fa5f5af99f16",
20+
"target_commit_id": "36d5d8c31c7d3332b43bd5fe4d40b515c6a71097",
21+
"app_name": "ram_loadable_app",
22+
"config_name": "defaults",
23+
"target": "esp32",
24+
"metrics": {
25+
"binary_size": {
26+
"source_value": 171448,
27+
"target_value": 173000,
28+
"difference": 1552,
29+
"difference_percentage": 0.91
30+
}
31+
},
32+
"app_path": "tools/test_apps/system/ram_loadable_app"
33+
},
34+
"tools/test_apps/system/ram_loadable_app_pure_ram_esp32": {
35+
"source_commit_id": "bacfa4aa59a37b70b800f1758106fa5f5af99f16",
36+
"target_commit_id": "36d5d8c31c7d3332b43bd5fe4d40b515c6a71097",
37+
"app_name": "ram_loadable_app",
38+
"config_name": "pure_ram",
39+
"target": "esp32",
40+
"metrics": {
41+
"binary_size": {
42+
"source_value": 156632,
43+
"target_value": 158200,
44+
"difference": 1568,
45+
"difference_percentage": 1.0
46+
}
47+
},
48+
"app_path": "tools/test_apps/system/ram_loadable_app"
49+
},
50+
"tools/test_apps/system/startup_flash_80m_qio_esp32": {
51+
"source_commit_id": "bacfa4aa59a37b70b800f1758106fa5f5af99f16",
52+
"target_commit_id": "36d5d8c31c7d3332b43bd5fe4d40b515c6a71097",
53+
"app_name": "startup",
54+
"config_name": "flash_80m_qio",
55+
"target": "esp32",
56+
"metrics": {
57+
"binary_size": {
58+
"source_value": 225692,
59+
"target_value": 230000,
60+
"difference": 4308,
61+
"difference_percentage": 1.91
62+
}
63+
},
64+
"app_path": "tools/test_apps/system/startup"
65+
},
66+
"tools/test_apps/system/startup_stack_check_verbose_log_esp32s3": {
67+
"source_commit_id": "bacfa4aa59a37b70b800f1758106fa5f5af99f16",
68+
"target_commit_id": "36d5d8c31c7d3332b43bd5fe4d40b515c6a71097",
69+
"app_name": "startup",
70+
"config_name": "stack_check_verbose_log",
71+
"target": "esp32s3",
72+
"metrics": {
73+
"binary_size": {
74+
"source_value": 156936,
75+
"target_value": 160000,
76+
"difference": 3064,
77+
"difference_percentage": 1.95
78+
}
79+
},
80+
"app_path": "tools/test_apps/system/startup"
81+
},
82+
"tools/test_apps/system/test_watchpoint_default_esp32": {
83+
"source_commit_id": "bacfa4aa59a37b70b800f1758106fa5f5af99f16",
84+
"target_commit_id": "36d5d8c31c7d3332b43bd5fe4d40b515c6a71097",
85+
"app_name": "test_watchpoint",
86+
"config_name": "default",
87+
"target": "esp32",
88+
"metrics": {
89+
"binary_size": {
90+
"source_value": 147896,
91+
"target_value": 150000,
92+
"difference": 2104,
93+
"difference_percentage": 1.42
94+
}
95+
},
96+
"app_path": "tools/test_apps/system/test_watchpoint"
97+
},
98+
"tools/test_apps/system/test_watchpoint_default_esp32c3": {
99+
"source_commit_id": "bacfa4aa59a37b70b800f1758106fa5f5af99f16",
100+
"target_commit_id": "36d5d8c31c7d3332b43bd5fe4d40b515c6a71097",
101+
"app_name": "test_watchpoint",
102+
"config_name": "default",
103+
"target": "esp32c3",
104+
"metrics": {
105+
"binary_size": {
106+
"source_value": 189456,
107+
"target_value": 190456,
108+
"difference": 1000,
109+
"difference_percentage": 0.53
110+
}
111+
},
112+
"app_path": "tools/test_apps/system/test_watchpoint"
113+
},
114+
"tools/test_apps/system/unicore_bootloader_multicore_esp32": {
115+
"source_commit_id": "bacfa4aa59a37b70b800f1758106fa5f5af99f16",
116+
"target_commit_id": "36d5d8c31c7d3332b43bd5fe4d40b515c6a71097",
117+
"app_name": "unicore_bootloader",
118+
"config_name": "multicore",
119+
"target": "esp32",
120+
"metrics": {
121+
"binary_size": {
122+
"source_value": 216784,
123+
"target_value": 220000,
124+
"difference": 3216,
125+
"difference_percentage": 1.48
126+
}
127+
},
128+
"app_path": "tools/test_apps/system/unicore_bootloader"
129+
},
130+
"tools/test_apps/system/unicore_bootloader_unicore_psram_esp32s3": {
131+
"source_commit_id": "bacfa4aa59a37b70b800f1758106fa5f5af99f16",
132+
"target_commit_id": "36d5d8c31c7d3332b43bd5fe4d40b515c6a71097",
133+
"app_name": "unicore_bootloader",
134+
"config_name": "unicore_psram",
135+
"target": "esp32s3",
136+
"metrics": {
137+
"binary_size": {
138+
"source_value": 189456,
139+
"target_value": 191456,
140+
"difference": 2000,
141+
"difference_percentage": 1.06
142+
}
143+
},
144+
"app_path": "tools/test_apps/system/unicore_bootloader"
145+
}
146+
}

0 commit comments

Comments
 (0)