[core] Native idf full support (#14678)

Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
Co-authored-by: Jonathan Swoboda <swoboda1337@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Diorcet Yann
2026-05-11 04:12:07 +02:00
committed by GitHub
parent 66e2dcffc4
commit e9cc10fedc
27 changed files with 3537 additions and 364 deletions

View File

@@ -562,7 +562,7 @@ def lint_constants_usage():
# Maximum allowed CONF_ constants in esphome/const.py.
# This file is frozen — new constants go in esphome/components/const/__init__.py.
# Decrease this number when constants are moved out of const.py.
CONST_PY_MAX_CONF = 1011
CONST_PY_MAX_CONF = 1012
@lint_content_check(include=["esphome/const.py"])

View File

@@ -175,7 +175,7 @@ def group_components_by_platform(
}
def format_github_summary(test_results: list[TestResult]) -> str:
def format_github_summary(test_results: list[TestResult], toolchain=None) -> str:
"""Format test results as GitHub Actions job summary markdown.
Args:
@@ -225,11 +225,12 @@ def format_github_summary(test_results: list[TestResult]) -> str:
lines.append("```bash\n")
# Generate one command per platform and test type
extra_arguments = f" --toolchain {toolchain}" if toolchain else ""
platform_components = group_components_by_platform(failed_results)
for platform, test_type in sorted(platform_components.keys()):
components_csv = ",".join(platform_components[(platform, test_type)])
lines.append(
f"script/test_build_components.py -c {components_csv} -t {platform} -e {test_type}\n"
f"script/test_build_components.py -c {components_csv} -t {platform} -e {test_type}{extra_arguments}\n"
)
lines.append("```\n")
@@ -274,13 +275,15 @@ def format_github_summary(test_results: list[TestResult]) -> str:
return "".join(lines)
def write_github_summary(test_results: list[TestResult]) -> None:
def write_github_summary(
test_results: list[TestResult], toolchain: str | None = None
) -> None:
"""Write GitHub Actions job summary with test results and timing.
Args:
test_results: List of all test results
"""
summary_content = format_github_summary(test_results)
summary_content = format_github_summary(test_results, toolchain)
with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as f:
f.write(summary_content)
@@ -308,6 +311,7 @@ def run_esphome_test(
esphome_command: str,
continue_on_fail: bool,
use_testing_mode: bool = False,
toolchain: str | None = None,
) -> TestResult:
"""Run esphome test for a single component.
@@ -367,8 +371,14 @@ def run_esphome_test(
]
)
# Add command and config file
cmd.extend([esphome_command, str(output_file)])
if toolchain:
cmd.extend(["--toolchain", toolchain])
# Add command
cmd.append(esphome_command)
# Add config file
cmd.append(str(output_file))
# Build command string for display/logging
cmd_str = " ".join(cmd)
@@ -432,6 +442,7 @@ def run_grouped_test(
tests_dir: Path,
esphome_command: str,
continue_on_fail: bool,
toolchain: str | None = None,
) -> TestResult:
"""Run esphome test for a group of components with shared bus configs.
@@ -510,10 +521,16 @@ def run_grouped_test(
"-s",
"target_platform",
platform,
esphome_command,
str(output_file),
]
if toolchain:
cmd.extend(["--toolchain", toolchain])
# Add command
cmd.append(esphome_command)
cmd.append(str(output_file))
# Build command string for display/logging
cmd_str = " ".join(cmd)
@@ -576,6 +593,7 @@ def run_grouped_component_tests(
esphome_command: str,
continue_on_fail: bool,
additional_isolated: set[str] | None = None,
toolchain: str | None = None,
) -> tuple[set[tuple[str, str]], list[TestResult]]:
"""Run grouped component tests.
@@ -879,6 +897,7 @@ def run_grouped_component_tests(
tests_dir=tests_dir,
esphome_command=esphome_command,
continue_on_fail=continue_on_fail,
toolchain=toolchain,
)
# Mark all components as tested
@@ -902,6 +921,7 @@ def run_individual_component_test(
continue_on_fail: bool,
tested_components: set[tuple[str, str]],
test_results: list[TestResult],
toolchain: str | None = None,
) -> None:
"""Run an individual component test if not already tested in a group.
@@ -930,6 +950,7 @@ def run_individual_component_test(
build_dir=build_dir,
esphome_command=esphome_command,
continue_on_fail=continue_on_fail,
toolchain=toolchain,
)
test_results.append(test_result)
@@ -942,6 +963,7 @@ def test_components(
enable_grouping: bool = True,
isolated_components: set[str] | None = None,
base_only: bool = False,
toolchain: str | None = None,
) -> int:
"""Test components with optional intelligent grouping.
@@ -1018,6 +1040,7 @@ def test_components(
esphome_command=esphome_command,
continue_on_fail=continue_on_fail,
additional_isolated=isolated_components,
toolchain=toolchain,
)
test_results.extend(grouped_results)
@@ -1046,6 +1069,7 @@ def test_components(
continue_on_fail=continue_on_fail,
tested_components=tested_components,
test_results=test_results,
toolchain=toolchain,
)
else:
# Platform-specific test
@@ -1078,6 +1102,7 @@ def test_components(
continue_on_fail=continue_on_fail,
tested_components=tested_components,
test_results=test_results,
toolchain=toolchain,
)
# Separate results into passed and failed
@@ -1098,17 +1123,18 @@ def test_components(
print("\n" + "=" * 80)
print("Commands to reproduce failures (copy-paste to reproduce locally):")
print("=" * 80)
extra_arguments = f" --toolchain {toolchain}" if toolchain else ""
platform_components = group_components_by_platform(failed_results)
for platform, test_type in sorted(platform_components.keys()):
components_csv = ",".join(platform_components[(platform, test_type)])
print(
f"script/test_build_components.py -c {components_csv} -t {platform} -e {test_type}"
f"script/test_build_components.py -c {components_csv} -t {platform} -e {test_type}{extra_arguments}"
)
print()
# Write GitHub Actions job summary if in CI
if os.environ.get("GITHUB_STEP_SUMMARY"):
write_github_summary(test_results)
write_github_summary(test_results, toolchain=toolchain)
if failed_results:
return 1
@@ -1161,6 +1187,10 @@ def main() -> int:
action="store_true",
help="Only test base test files (test.*.yaml), not variant files (test-*.yaml)",
)
parser.add_argument(
"--toolchain",
help="Select toolchain for compiling.",
)
args = parser.parse_args()
@@ -1180,6 +1210,7 @@ def main() -> int:
enable_grouping=not args.no_grouping,
isolated_components=isolated_components,
base_only=args.base_only,
toolchain=args.toolchain,
)