Skip to content

Commit 3175db5

Browse files
committed
ci: move extra targets need to be built by default to --additional-build-targets
1 parent 5086184 commit 3175db5

File tree

7 files changed

+26
-52
lines changed

7 files changed

+26
-52
lines changed

.gitlab/ci/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,6 @@ generate_disabled_apps_report:
370370
expire_in: 1 week
371371
when: always
372372
script:
373-
- pip install dominate idf-build-apps>=2.12.0
373+
- pip install dominate idf-build-apps
374374
- run_cmd python tools/ci/gen_disabled_report.py --output disabled_report.html --verbose --enable-preview-targets
375375
- echo "Report generated at https://${CI_PAGES_HOSTNAME}:${CI_SERVER_PORT}/-/esp-idf/-/jobs/${CI_JOB_ID}/artifacts/disabled_report.html"

.gitlab/ci/default-build-test-rules.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
# - extra_default_build_targets:
33
# besides of the SUPPORTED_TARGETS in IDF,
44
# enable build for the specified targets by default as well.
5+
# !!! DEPRECATED: use `additional_build_targets` in .idf_build_apps.toml instead
6+
#
57
# - bypass_check_test_targets:
68
# suppress the check_build_test_rules check-test-script warnings for the specified targets
79
#
810
# This file should ONLY be used during bringup. Should be reset to empty after the bringup process
9-
extra_default_build_targets:
10-
- esp32c5
11-
- esp32c61
12-
- esp32h21
13-
- esp32h4
1411

1512
bypass_check_test_targets:
1613
- esp32h21

.idf_build_apps.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ size_json_filename = "size_${CI_JOB_ID}.json"
2525

2626
verbose = 1 # INFO
2727

28+
additional_build_targets = [
29+
'esp32h21',
30+
'esp32h4',
31+
]
32+
2833
# collect
2934
collect_app_info_filename = "app_info_${CI_JOB_NAME_SLUG}.txt"
3035
junitxml = "build_summary_${CI_JOB_NAME_SLUG}.xml"

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ repos:
144144
require_serial: true
145145
additional_dependencies:
146146
- PyYAML == 5.3.1
147-
- idf-build-apps~=2.12
147+
- idf-build-apps~=2.13
148148
- id: sort-yaml-files
149149
name: sort yaml files
150150
entry: tools/ci/sort_yaml.py

conftest.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ def test_case_name(request: FixtureRequest, target: str, config: str) -> str:
9191

9292

9393
@pytest.fixture(scope='session')
94-
def pipeline_id(request: FixtureRequest) -> t.Optional[str]:
94+
def pipeline_id(request: FixtureRequest) -> str | None:
9595
return request.config.getoption('pipeline_id', None) or os.getenv('PARENT_PIPELINE_ID', None) # type: ignore
9696

9797

98-
def get_pipeline_commit_sha_by_pipeline_id(pipeline_id: str) -> t.Optional[str]:
98+
def get_pipeline_commit_sha_by_pipeline_id(pipeline_id: str) -> str | None:
9999
gl = gitlab_api.Gitlab(os.getenv('CI_PROJECT_ID', 'espressif/esp-idf'))
100100
pipeline = gl.project.pipelines.get(pipeline_id)
101101
if not pipeline:
@@ -120,12 +120,12 @@ class AppDownloader:
120120
def __init__(
121121
self,
122122
commit_sha: str,
123-
pipeline_id: t.Optional[str] = None,
123+
pipeline_id: str | None = None,
124124
) -> None:
125125
self.commit_sha = commit_sha
126126
self.pipeline_id = pipeline_id
127127

128-
def download_app(self, app_build_path: str, artifact_type: t.Optional[str] = None) -> None:
128+
def download_app(self, app_build_path: str, artifact_type: str | None = None) -> None:
129129
args = [
130130
'idf-ci',
131131
'gitlab',
@@ -155,9 +155,9 @@ def __init__(self, dut: 'IdfDut'):
155155
self.RETRY_DELAY = 1
156156
self.TELNET_PORT = 4444
157157
self.dut = dut
158-
self.telnet: t.Optional[Telnet] = None
158+
self.telnet: Telnet | None = None
159159
self.log_file = os.path.join(self.dut.logdir, 'ocd.txt')
160-
self.proc: t.Optional[pexpect.spawn] = None
160+
self.proc: pexpect.spawn | None = None
161161

162162
def __enter__(self) -> 'OpenOCD':
163163
return self
@@ -169,7 +169,7 @@ def run(self) -> t.Optional['OpenOCD']:
169169
desc_path = os.path.join(self.dut.app.binary_path, 'project_description.json')
170170

171171
try:
172-
with open(desc_path, 'r') as f:
172+
with open(desc_path) as f:
173173
project_desc = json.load(f)
174174
except FileNotFoundError:
175175
logging.error('Project description file not found at %s', desc_path)
@@ -200,7 +200,7 @@ def run(self) -> t.Optional['OpenOCD']:
200200
if self.proc and self.proc.isalive():
201201
self.proc.expect_exact('Info : Listening on port 3333 for gdb connections', timeout=5)
202202
self.connect_telnet()
203-
self.write('log_output {}'.format(self.log_file))
203+
self.write(f'log_output {self.log_file}')
204204
return self
205205
except (pexpect.exceptions.EOF, pexpect.exceptions.TIMEOUT, ConnectionRefusedError) as e:
206206
logging.error('Error running OpenOCD: %s', str(e))
@@ -258,8 +258,8 @@ def openocd_dut(dut: IdfDut) -> OpenOCD:
258258

259259
@pytest.fixture(scope='session')
260260
def app_downloader(
261-
pipeline_id: t.Optional[str],
262-
) -> t.Optional[AppDownloader]:
261+
pipeline_id: str | None,
262+
) -> AppDownloader | None:
263263
if commit_sha := os.getenv('PIPELINE_COMMIT_SHA'):
264264
logging.debug('pipeline commit sha from CI env is %s', commit_sha)
265265
return AppDownloader(commit_sha, None)
@@ -283,9 +283,9 @@ def app_downloader(
283283
def build_dir(
284284
request: FixtureRequest,
285285
app_path: str,
286-
target: t.Optional[str],
287-
config: t.Optional[str],
288-
app_downloader: t.Optional[AppDownloader],
286+
target: str | None,
287+
config: str | None,
288+
app_downloader: AppDownloader | None,
289289
) -> str:
290290
"""
291291
Check local build dir with the following priority:
@@ -561,10 +561,10 @@ def get_path(x: str) -> str:
561561

562562
if isinstance(_dut, list):
563563
logs_files.extend([template.format(get_path(d.logfile)) for d in _dut])
564-
dut_artifacts_url.append('{}:'.format(_dut[0].test_case_name))
564+
dut_artifacts_url.append(f'{_dut[0].test_case_name}:')
565565
else:
566566
logs_files.append(template.format(get_path(_dut.logfile)))
567-
dut_artifacts_url.append('{}:'.format(_dut.test_case_name))
567+
dut_artifacts_url.append(f'{_dut.test_case_name}:')
568568

569569
for file in logs_files:
570570
dut_artifacts_url.append(' - {}'.format(quote(file, safe=':/')))

tools/ci/check_build_test_rules.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,12 @@ def parse_existing_table(app_dir: str) -> tuple[str | None, list[str]]:
124124
def get_grouped_apps(
125125
paths: list[str],
126126
exclude_dirs: list[str] | None = None,
127-
extra_targets: list[str] | None = None,
128127
) -> dict[str, list[App]]:
129128
apps = sorted(
130129
find_apps(
131130
paths,
132131
'all',
133132
exclude_list=exclude_dirs or [],
134-
default_build_targets=SUPPORTED_TARGETS + (extra_targets or []),
135133
)
136134
)
137135

@@ -145,10 +143,8 @@ def get_grouped_apps(
145143
def check_readme(
146144
paths: list[str],
147145
exclude_dirs: list[str] | None = None,
148-
*,
149-
extra_targets: list[str] | None = None,
150146
) -> None:
151-
grouped_apps = get_grouped_apps(paths, exclude_dirs, extra_targets)
147+
grouped_apps = get_grouped_apps(paths, exclude_dirs)
152148
exit_code = 0
153149

154150
for app_dir, apps in grouped_apps.items():
@@ -243,11 +239,10 @@ def check_test_scripts(
243239
paths: list[str],
244240
exclude_dirs: list[str] | None = None,
245241
*,
246-
extra_targets: list[str] | None = None,
247242
bypass_targets: list[str] | None = None,
248243
) -> None:
249244
# takes long time, run only in CI
250-
grouped_apps = get_grouped_apps(paths, exclude_dirs, extra_targets)
245+
grouped_apps = get_grouped_apps(paths, exclude_dirs)
251246
grouped_cases = get_grouped_cases(paths)
252247
exit_code = 0
253248

@@ -347,14 +342,12 @@ def check_test_scripts(
347342
else:
348343
_exclude_dirs = [os.path.join(IDF_PATH, 'tools', 'templates', 'sample_project')]
349344

350-
_extra_targets: list[str] = []
351345
_bypass_targets: list[str] = []
352346
if arg.config:
353347
with open(arg.config) as fr:
354348
configs = yaml.safe_load(fr)
355349

356350
if configs:
357-
_extra_targets = configs.get('extra_default_build_targets') or []
358351
_bypass_targets = configs.get('bypass_check_test_targets') or []
359352

360353
os.environ.update(
@@ -369,12 +362,10 @@ def check_test_scripts(
369362
check_readme(
370363
list(check_dirs),
371364
_exclude_dirs,
372-
extra_targets=_extra_targets,
373365
)
374366
elif arg.action == 'check-test-scripts':
375367
check_test_scripts(
376368
list(check_dirs),
377369
_exclude_dirs,
378-
extra_targets=_extra_targets,
379370
bypass_targets=_bypass_targets,
380371
)

tools/ci/dynamic_pipelines/scripts/generate_build_child_pipeline.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import os
88

99
import __init__ # noqa: F401 # inject the system path
10-
import yaml
11-
from idf_build_apps.manifest import DEFAULT_BUILD_TARGETS
1210
from idf_build_apps.utils import semicolon_separated_str_to_list
1311
from idf_ci.idf_gitlab import build_child_pipeline
1412
from idf_ci.utils import setup_logging
@@ -35,18 +33,6 @@ def _separate_str_to_list(s: str) -> list[str]:
3533

3634

3735
def main(arguments: argparse.Namespace) -> None:
38-
# load from default build test rules config file
39-
extra_default_build_targets: list[str] = []
40-
if arguments.default_build_test_rules:
41-
with open(arguments.default_build_test_rules) as fr:
42-
configs = yaml.safe_load(fr)
43-
44-
if configs:
45-
extra_default_build_targets = configs.get('extra_default_build_targets') or []
46-
47-
if extra_default_build_targets:
48-
DEFAULT_BUILD_TARGETS.set(list(set(DEFAULT_BUILD_TARGETS.get()).union(set(extra_default_build_targets))))
49-
5036
setup_logging(logging.DEBUG)
5137
build_child_pipeline(
5238
paths=args.paths,
@@ -75,11 +61,6 @@ def main(arguments: argparse.Namespace) -> None:
7561
default=TEST_PATHS,
7662
help='Paths to the apps to build.',
7763
)
78-
parser.add_argument(
79-
'--default-build-test-rules',
80-
default=os.path.join(IDF_PATH, '.gitlab', 'ci', 'default-build-test-rules.yml'),
81-
help='default build test rules config file',
82-
)
8364
parser.add_argument(
8465
'--compare-manifest-sha-filepath',
8566
default=os.path.join(IDF_PATH, '.manifest_sha'),

0 commit comments

Comments
 (0)