Merge branch 'ci/run_build_test_check_when_soc_updated' into 'master'

CI: run build test check when soc caps updated

See merge request espressif/esp-idf!19940
pull/9732/head
Fu Hanxi 2022-09-06 09:33:01 +08:00
commit 24c31bd7fb
1 zmienionych plików z 26 dodań i 8 usunięć

Wyświetl plik

@ -30,6 +30,7 @@ USUAL_TO_FORMAL = {
'esp32c3': 'ESP32-C3',
'esp32h2': 'ESP32-H2',
'esp32c2': 'ESP32-C2',
'esp32c6': 'ESP32-C6',
'linux': 'Linux',
}
@ -40,6 +41,7 @@ FORMAL_TO_USUAL = {
'ESP32-C3': 'esp32c3',
'ESP32-H2': 'esp32h2',
'ESP32-C2': 'esp32c2',
'ESP32-C6': 'esp32c6',
'Linux': 'linux',
}
@ -51,7 +53,7 @@ def doublequote(s: str) -> str:
return f'"{s}"'
def check_readme(paths: List[str]) -> None:
def check_readme(paths: List[str], exclude_dirs: Optional[List[str]] = None) -> None:
from idf_build_apps import App, find_apps
from idf_build_apps.constants import SUPPORTED_TARGETS
@ -136,6 +138,7 @@ def check_readme(paths: List[str]) -> None:
paths,
'all',
recursive=True,
exclude_list=exclude_dirs or [],
manifest_files=[
str(p) for p in Path(IDF_PATH).glob('**/.build-test-rules.yml')
],
@ -196,7 +199,7 @@ def check_readme(paths: List[str]) -> None:
sys.exit(exit_code)
def check_test_scripts(paths: List[str]) -> None:
def check_test_scripts(paths: List[str], exclude_dirs: Optional[List[str]] = None) -> None:
from idf_build_apps import App, find_apps
# takes long time, run only in CI
@ -303,6 +306,7 @@ def check_test_scripts(paths: List[str]) -> None:
paths,
'all',
recursive=True,
exclude_list=exclude_dirs or [],
manifest_files=[
str(p) for p in Path(IDF_PATH).glob('**/.build-test-rules.yml')
],
@ -413,13 +417,27 @@ if __name__ == '__main__':
sort_yaml(arg.files)
else:
check_dirs = set()
for path in arg.paths:
if os.path.isfile(path):
check_dirs.add(os.path.dirname(path))
# check if *_caps.h files changed
check_all = False
soc_caps_header_files = list((Path(IDF_PATH) / 'components' / 'soc').glob('**/*_caps.h'))
for p in arg.paths:
if Path(p).resolve() in soc_caps_header_files:
check_all = True
break
if os.path.isfile(p):
check_dirs.add(os.path.dirname(p))
else:
check_dirs.add(path)
check_dirs.add(p)
if check_all:
check_dirs = {IDF_PATH}
_exclude_dirs = [os.path.join(IDF_PATH, 'tools', 'unit-test-app')]
else:
_exclude_dirs = []
if arg.action == 'check-readmes':
check_readme(list(check_dirs))
check_readme(list(check_dirs), _exclude_dirs)
elif arg.action == 'check-test-scripts':
check_test_scripts(list(check_dirs))
check_test_scripts(list(check_dirs), _exclude_dirs)