[ci] Run C++ unit tests when a component's Python or test override changes (#18706)

This commit is contained in:
J. Nick Koston
2026-08-24 12:18:17 -05:00
committed by GitHub
parent b8408e14b9
commit 49fc4be861
6 changed files with 202 additions and 43 deletions
+5 -8
View File
@@ -3,7 +3,6 @@ import argparse
from helpers import (
changed_files,
filter_component_and_test_cpp_files,
filter_component_and_test_files,
get_all_component_files,
get_components_with_dependencies,
@@ -38,7 +37,7 @@ def main():
parser.add_argument(
"--cpp-changed",
action="store_true",
help="List components with changed C++ files",
help="List components whose C++ unit tests are affected by changed files",
)
args = parser.parse_args()
@@ -78,9 +77,9 @@ def main():
# Returns: Components with code changes + their dependencies (not infrastructure)
# Reason: CI needs to test changed components and their dependents
#
# - --cpp-changed: Used by CI to determine if any C++ files changed (script/determine-jobs.py)
# Returns: Only components with changed C++ files
# Reason: Only components with C++ changes need C++ testing
# - --cpp-changed: Mirrors the C++ unit test selection in script/determine-jobs.py
# Returns: Components with changed C++ or Python files (plus dependents)
# Reason: Python decides which sources and defines go into the host test build
base_test_changed = any(
"tests/test_build_components" in file for file in changed
@@ -115,9 +114,7 @@ def main():
for c in get_components_with_dependencies(files, False):
print(c)
elif args.cpp_changed:
# Only look at changed cpp files
files = list(filter(filter_component_and_test_cpp_files, changed))
for c in get_cpp_changed_components(files):
for c in get_cpp_changed_components(changed):
print(c)
else:
# Return all changed components (with dependencies) - default behavior