mirror of
https://github.com/esphome/esphome.git
synced 2026-10-01 17:00:21 +00:00
Simplify the native dispatch and CI cache wiring
A cache-arduino8266 composite action mirrors cache-esp-idf (one key resolver, dev-writes/PR-restores) and both jobs pin ESPHOME_ARDUINO8266_PREFIX so YAML and Python agree on the path by construction. esp32 provides the native_toolchain_module hook, so the shared dispatcher never names a backend and the unclaimed-native raise loses its esp-idf carve-out; the esp8266 decode and run_compile hooks resolve through the same seam. run_compile resolves ccache once and threads it to the generator, env, and idedata; the compdb rule names follow the shared kinds; the pio-options warner inlines into the driver and derives its consumed set from the core routing constant; the per-toolchain CI narrowing shares one body; create_components_graph is memoized per run; the decode rate-limit drops its math sentinel.
This commit is contained in:
@@ -50,6 +50,7 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
from collections import Counter
|
||||
from collections.abc import Callable
|
||||
from enum import StrEnum
|
||||
from functools import cache
|
||||
import json
|
||||
@@ -595,12 +596,23 @@ def esp32_platformio_components_to_test(branch: str | None = None) -> list[str]:
|
||||
Returns:
|
||||
Sorted list of component names to compile.
|
||||
"""
|
||||
return _native_components_to_test(
|
||||
branch, ESP32_PLATFORMIO_TEST_COMPONENTS, _esp32_platformio_path_or_file_trigger
|
||||
)
|
||||
|
||||
|
||||
def _native_components_to_test(
|
||||
branch: str | None,
|
||||
test_set: frozenset[str] | set[str],
|
||||
infra_trigger: Callable[[list[str]], bool],
|
||||
) -> list[str]:
|
||||
"""The shared narrowing rule for the per-toolchain smoke-test jobs."""
|
||||
files = changed_files(branch)
|
||||
|
||||
if core_changed(files) or _esp32_platformio_path_or_file_trigger(files):
|
||||
return sorted(ESP32_PLATFORMIO_TEST_COMPONENTS)
|
||||
if core_changed(files) or infra_trigger(files):
|
||||
return sorted(test_set)
|
||||
|
||||
return sorted(ESP32_PLATFORMIO_TEST_COMPONENTS & _changed_components_closure(files))
|
||||
return sorted(test_set & _changed_components_closure(files))
|
||||
|
||||
|
||||
def should_run_esp32_platformio(branch: str | None = None) -> bool:
|
||||
@@ -682,12 +694,9 @@ def esp8266_native_components_to_test(branch: str | None = None) -> list[str]:
|
||||
list on core or infrastructure changes, otherwise the intersection with
|
||||
the changed-component dependency closure (empty list skips the job).
|
||||
"""
|
||||
files = changed_files(branch)
|
||||
|
||||
if core_changed(files) or _esp8266_native_path_or_file_trigger(files):
|
||||
return sorted(ESP8266_NATIVE_TEST_COMPONENTS)
|
||||
|
||||
return sorted(ESP8266_NATIVE_TEST_COMPONENTS & _changed_components_closure(files))
|
||||
return _native_components_to_test(
|
||||
branch, ESP8266_NATIVE_TEST_COMPONENTS, _esp8266_native_path_or_file_trigger
|
||||
)
|
||||
|
||||
|
||||
def determine_cpp_unit_tests(
|
||||
|
||||
@@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
import ast
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass, field
|
||||
import functools
|
||||
from functools import cache
|
||||
import hashlib
|
||||
import json
|
||||
@@ -1248,6 +1249,7 @@ def get_components_graph_cache_key() -> str:
|
||||
return hasher.hexdigest()
|
||||
|
||||
|
||||
@functools.cache
|
||||
def create_components_graph() -> dict[str, list[str]]:
|
||||
"""Create a graph of component dependencies (cached).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user