[ci] Add ci-run-all label to force full CI matrix (#16421)

This commit is contained in:
Jonathan Swoboda
2026-05-14 18:54:13 -04:00
committed by GitHub
parent 313d974983
commit a92b607754
3 changed files with 231 additions and 26 deletions

View File

@@ -1062,22 +1062,42 @@ def main() -> None:
parser.add_argument(
"-b", "--branch", help="Branch to compare changed files against"
)
parser.add_argument(
"--force-all",
action="store_true",
help=(
"Force every job to run regardless of what changed. Used by CI "
"when the ci-run-all label is applied to a PR (escape hatch for "
"changes that need full-matrix validation but don't touch enough "
"files to trigger it organically)."
),
)
args = parser.parse_args()
# Determine what should run
integration_run_all, integration_test_files = determine_integration_tests(
args.branch
)
if args.force_all:
integration_run_all, integration_test_files = True, []
run_clang_tidy = True
run_clang_format = True
run_python_linters = True
run_import_time = True
run_device_builder = True
native_idf_components = sorted(NATIVE_IDF_TEST_COMPONENTS)
run_native_idf = True
else:
integration_run_all, integration_test_files = determine_integration_tests(
args.branch
)
run_clang_tidy = should_run_clang_tidy(args.branch)
run_clang_format = should_run_clang_format(args.branch)
run_python_linters = should_run_python_linters(args.branch)
run_import_time = should_run_import_time(args.branch)
run_device_builder = should_run_device_builder(args.branch)
native_idf_components = native_idf_components_to_test(args.branch)
run_native_idf = bool(native_idf_components)
run_integration, integration_test_buckets = _compute_integration_test_buckets(
integration_run_all, integration_test_files
)
run_clang_tidy = should_run_clang_tidy(args.branch)
run_clang_format = should_run_clang_format(args.branch)
run_python_linters = should_run_python_linters(args.branch)
run_import_time = should_run_import_time(args.branch)
run_device_builder = should_run_device_builder(args.branch)
native_idf_components = native_idf_components_to_test(args.branch)
run_native_idf = bool(native_idf_components)
changed_cpp_file_count = count_changed_cpp_files(args.branch)
# Get changed components
@@ -1106,11 +1126,27 @@ def main() -> None:
changed_components = changed_components_result
is_core_change = False
# Filter to only components that have test files
# Components without tests shouldn't generate CI test jobs
changed_components_with_tests = [
component for component in changed_components if _component_has_tests(component)
]
if args.force_all:
# Force every component with tests into the CI matrix. Each disk entry
# under tests/components/<name> is treated as a component; filtered
# below by _component_has_tests so components without YAML tests are
# still excluded.
tests_root = Path(root_path) / ESPHOME_TESTS_COMPONENTS_PATH
all_components = sorted(d.name for d in tests_root.iterdir() if d.is_dir())
changed_components_with_tests = [
component for component in all_components if _component_has_tests(component)
]
# Treat as a core change so downstream logic (clang-tidy full scan,
# dep expansion) sees the same world as when esphome/core/ changes.
is_core_change = True
else:
# Filter to only components that have test files
# Components without tests shouldn't generate CI test jobs
changed_components_with_tests = [
component
for component in changed_components
if _component_has_tests(component)
]
# Get directly changed components with tests (for isolated testing)
# These will be tested WITHOUT --testing-mode in CI to enable full validation
@@ -1143,8 +1179,10 @@ def main() -> None:
memory_impact = detect_memory_impact_config(args.branch)
# Determine clang-tidy mode based on actual files that will be checked
is_full_scan = False
if run_clang_tidy:
# Full scan needed if: hash changed OR core files changed
# (is_core_change is forced True under --force-all)
is_full_scan = _is_clang_tidy_full_scan() or is_core_change
if is_full_scan:
@@ -1177,10 +1215,12 @@ def main() -> None:
# Build output
# Determine which C++ unit tests to run
cpp_run_all, cpp_components = determine_cpp_unit_tests(args.branch)
# Determine if benchmarks should run
run_benchmarks = should_run_benchmarks(args.branch)
if args.force_all:
cpp_run_all, cpp_components = True, []
run_benchmarks = True
else:
cpp_run_all, cpp_components = determine_cpp_unit_tests(args.branch)
run_benchmarks = should_run_benchmarks(args.branch)
# Split components into batches for CI testing
# This intelligently groups components with similar bus configurations
@@ -1219,6 +1259,7 @@ def main() -> None:
"integration_test_buckets": integration_test_buckets,
"clang_tidy": run_clang_tidy,
"clang_tidy_mode": clang_tidy_mode,
"clang_tidy_full_scan": is_full_scan,
"clang_format": run_clang_format,
"python_linters": run_python_linters,
"import_time": run_import_time,