Skip to content

Commit b2d92fd

Browse files
committed
Merge branch 'ci_build/few_examples' into 'main'
tools/ci: Reduced the number of no pytest examples in CI. See merge request app-frameworks/esp-matter!972
2 parents dcab1aa + 159993d commit b2d92fd

File tree

2 files changed

+85
-2
lines changed

2 files changed

+85
-2
lines changed

.gitlab-ci.yml

+32
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,38 @@ build_esp_matter_examples:
371371
--parallel-index ${CI_NODE_INDEX:-1}
372372
parallel: 2
373373

374+
build_nopytest_remaining_examples_manual:
375+
extends:
376+
- .build_examples_template
377+
rules:
378+
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"
379+
when: on_success
380+
- if: $CI_COMMIT_BRANCH != "main"
381+
when: manual
382+
allow_failure: true
383+
needs:
384+
- job: build_image
385+
optional: true
386+
artifacts:
387+
paths:
388+
- "examples/**/build*/size.json"
389+
- "examples/**/build*/build_log.txt"
390+
- "examples/**/build*/*.bin"
391+
- "examples/**/build*/flasher_args.json"
392+
- "examples/**/build*/config/sdkconfig.json"
393+
- "examples/**/build*/bootloader/*.bin"
394+
- "examples/**/build*/partition_table/*.bin"
395+
when: always
396+
expire_in: 4 days
397+
script:
398+
- cd ${ESP_MATTER_PATH}
399+
- pip install -r tools/ci/requirements-build.txt
400+
- python tools/ci/build_apps.py ./examples --no_pytest_remaining
401+
--parallel-count ${CI_NODE_TOTAL:-1}
402+
--parallel-index ${CI_NODE_INDEX:-1}
403+
parallel: 2
404+
405+
374406
build_esp_matter_examples_pytest_C3_idf_v4_4:
375407
extends:
376408
- .build_examples_template

tools/ci/build_apps.py

+53-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,43 @@
4747
str(PROJECT_ROOT / 'examples' / '.build-rules.yml'),
4848
]
4949

50+
# Exclude list for no-pytest apps in CI on merge request or branch pipelines.
51+
# The below examples will be built on main branch pipeline.
52+
NO_PYTEST_REMAINING_APPS = [
53+
{"target": "esp32c2", "name": "light_switch"},
54+
{"target": "esp32c6", "name": "light_switch"},
55+
{"target": "esp32h2", "name": "light_switch"},
56+
{"target": "esp32" , "name": "light_switch"},
57+
{"target": "esp32c2", "name": "generic_switch"},
58+
{"target": "esp32c6", "name": "generic_switch"},
59+
{"target": "esp32h2", "name": "generic_switch"},
60+
{"target": "esp32h2", "name": "multiple_on_off_plugin_units"},
61+
{"target": "esp32c3", "name": "multiple_on_off_plugin_units"},
62+
{"target": "esp32" , "name": "multiple_on_off_plugin_units"},
63+
{"target": "esp32s3", "name": "multiple_on_off_plugin_units"},
64+
{"target": "esp32" , "name": "room_air_conditioner"},
65+
{"target": "esp32c3", "name": "room_air_conditioner"},
66+
{"target": "esp32c2", "name": "room_air_conditioner"},
67+
{"target": "esp32c6", "name": "room_air_conditioner"},
68+
{"target": "esp32h2", "name": "room_air_conditioner"},
69+
{"target": "esp32" , "name": "door_lock"},
70+
{"target": "esp32c3", "name": "door_lock"},
71+
{"target": "esp32c2", "name": "door_lock"},
72+
{"target": "esp32c6", "name": "door_lock"},
73+
{"target": "esp32h2", "name": "door_lock"},
74+
{"target": "esp32s3", "name": "ota_provider"},
75+
{"target": "esp32c3", "name": "sensors"},
76+
{"target": "esp32" , "name": "refrigerator"},
77+
{"target": "esp32c3", "name": "refrigerator"},
78+
{"target": "esp32c2", "name": "refrigerator"},
79+
{"target": "esp32c6", "name": "refrigerator"},
80+
{"target": "esp32h2", "name": "refrigerator"},
81+
{"target": "esp32" , "name": "demo/badge"},
82+
]
83+
MAINFEST_FILES = [
84+
str(PROJECT_ROOT / 'examples' / '.build-rules.yml'),
85+
]
86+
5087
def _is_c6_pytest_app(app: App) -> bool:
5188
print(app.name, app.target)
5289
for pytest_app in PYTEST_C6_APPS:
@@ -73,6 +110,13 @@ def _is_c2_pytest_app(app: App) -> bool:
73110
return True
74111
return False
75112

113+
# Function to check for no_pytest excluded list apps.
114+
def _is_no_pytest_remaining_app(app: App) -> bool:
115+
for no_pytest_app in NO_PYTEST_REMAINING_APPS:
116+
if app.name == no_pytest_app["name"] and app.target == no_pytest_app["target"]:
117+
return True
118+
return False
119+
76120
def get_cmake_apps(
77121
paths: List[str],
78122
target: str,
@@ -97,7 +141,7 @@ def main(args: argparse.Namespace) -> None:
97141
# no_pytest and only_pytest can not be both True
98142
assert not (args.no_pytest and args.pytest_c6 and args.pytest_h2 and args.pytest_c3 and args.pytest_c2)
99143
if args.no_pytest:
100-
apps_for_build = [app for app in apps if not (_is_c6_pytest_app(app) or _is_h2_pytest_app(app))]
144+
apps_for_build = [app for app in apps if not (_is_c6_pytest_app(app) or _is_h2_pytest_app(app) or _is_no_pytest_remaining_app(app))]
101145
elif args.pytest_c6:
102146
apps_for_build = [app for app in apps if _is_c6_pytest_app(app)]
103147
elif args.pytest_h2:
@@ -106,6 +150,8 @@ def main(args: argparse.Namespace) -> None:
106150
apps_for_build = [app for app in apps if _is_c3_pytest_app(app)]
107151
elif args.pytest_c2:
108152
apps_for_build = [app for app in apps if _is_c2_pytest_app(app)]
153+
elif args.no_pytest_remaining:
154+
apps_for_build = [app for app in apps if _is_no_pytest_remaining_app(app)]
109155
else:
110156
apps_for_build = apps[:]
111157

@@ -164,7 +210,12 @@ def main(args: argparse.Namespace) -> None:
164210
parser.add_argument(
165211
'--no_pytest',
166212
action="store_true",
167-
help='Exclude pytest apps, definded in PYTEST_H2_APPS and PYTEST_C6_APPS',
213+
help='Exclude pytest apps definded in PYTEST_H2_APPS and PYTEST_C6_APPS and some optional no-pytest apps',
214+
)
215+
parser.add_argument(
216+
'--no_pytest_remaining',
217+
action="store_true",
218+
help='Build the excluded no-pytest apps using manual trigger.',
168219
)
169220
parser.add_argument(
170221
'--pytest_c6',

0 commit comments

Comments
 (0)