1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-12 23:03:46 +01:00
This commit is contained in:
J. Nick Koston
2025-10-09 06:31:13 -10:00
parent c162970ec5
commit fbfa2349a5
18 changed files with 52 additions and 26 deletions

View File

@@ -25,6 +25,13 @@ from script.analyze_component_buses import (
create_grouping_signature, create_grouping_signature,
) )
# Components that must be tested in isolation (not grouped or batched with others)
# These have known build issues that prevent grouping
# NOTE: This should be kept in sync with ISOLATED_COMPONENTS in test_build_components
ISOLATED_COMPONENTS = {
"camera_encoder": "Multiple definition errors: esp32-camera IDF component conflicts with ESPHome camera component",
}
def create_intelligent_batches( def create_intelligent_batches(
components: list[str], components: list[str],
@@ -42,17 +49,31 @@ def create_intelligent_batches(
List of component batches (lists of component names) List of component batches (lists of component names)
""" """
# Analyze all components to get their bus signatures # Analyze all components to get their bus signatures
component_buses, _ = analyze_all_components(tests_dir) component_buses, non_groupable = analyze_all_components(tests_dir)
# Group components by their bus signature ONLY (ignore platform) # Group components by their bus signature ONLY (ignore platform)
# All platforms will be tested by test_build_components.py for each batch # All platforms will be tested by test_build_components.py for each batch
# Key: signature, Value: list of components # Key: signature, Value: list of components
signature_groups: dict[str, list[str]] = defaultdict(list) signature_groups: dict[str, list[str]] = defaultdict(list)
# Track isolated components separately (they get their own batches)
isolated_components = []
for component in components: for component in components:
# Check if component must be tested in isolation
if component in ISOLATED_COMPONENTS:
isolated_components.append(component)
continue
# Skip components that can't be grouped (use local files)
if component in non_groupable:
signature_groups["isolated"].append(component)
continue
if component not in component_buses: if component not in component_buses:
# Component has no bus configs, put in special group # Component has no bus configs, put in "no_buses" group
signature_groups["none"].append(component) # These components CAN be grouped together
signature_groups["no_buses"].append(component)
continue continue
# Get signature from any platform (they should all have the same buses) # Get signature from any platform (they should all have the same buses)
@@ -64,22 +85,23 @@ def create_intelligent_batches(
signature_groups[signature].append(component) signature_groups[signature].append(component)
break # Only use first platform for grouping break # Only use first platform for grouping
else: else:
# No buses found # No buses found for any platform - can be grouped together
signature_groups["none"].append(component) signature_groups["no_buses"].append(component)
# Create batches by keeping signature groups together # Create batches by keeping signature groups together
# Components with the same signature stay in the same batches # Components with the same signature stay in the same batches
batches = [] batches = []
# Sort signature groups to prioritize groupable components # Sort signature groups to prioritize groupable components
# 1. Put "none" signature last (can't be grouped) # 1. Put "isolated" signature last (can't be grouped with others)
# 2. Sort groupable signatures by size (largest first) # 2. Sort groupable signatures by size (largest first)
# 3. "no_buses" components CAN be grouped together
def sort_key(item): def sort_key(item):
signature, components = item signature, components = item
is_none = signature == "none" is_isolated = signature == "isolated"
# Put "none" last (1), groupable first (0) # Put "isolated" last (1), groupable first (0)
# Within each category, sort by size (largest first) # Within each category, sort by size (largest first)
return (is_none, -len(components)) return (is_isolated, -len(components))
sorted_groups = sorted(signature_groups.items(), key=sort_key) sorted_groups = sorted(signature_groups.items(), key=sort_key)
@@ -99,6 +121,10 @@ def create_intelligent_batches(
batch = all_components[i : i + batch_size] batch = all_components[i : i + batch_size]
batches.append(batch) batches.append(batch)
# Add isolated components as individual batches (one component per batch)
# These must be tested alone due to known build issues
batches.extend([component] for component in isolated_components)
return batches return batches

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-ard.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-ard.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-ard.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-ard.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-idf.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-idf.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-idf.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-idf.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp8266-ard.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp8266-ard.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-ard.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-ard.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-ard.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-ard.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-idf.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-idf.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-idf.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-idf.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp8266-ard.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp8266-ard.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/rp2040-ard.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/rp2040-ard.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-ard.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-ard.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-ard.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-ard.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-idf.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-c3-idf.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp32-idf.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp32-idf.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/esp8266-ard.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/esp8266-ard.yaml
<<: !include common.yaml <<: !include common.yaml

View File

@@ -1,4 +1,4 @@
packages: packages:
i2c: !include ../../test_build_components/common/i2c_low_freq/rp2040-ard.yaml i2c_low_freq: !include ../../test_build_components/common/i2c_low_freq/rp2040-ard.yaml
<<: !include common.yaml <<: !include common.yaml