feat(ci): add CI check for EXTRA_COMPONENT_DIRS in examples

This commit is contained in:
Ivan Grokhotkov 2023-09-18 13:37:18 +02:00
parent 6d87100a70
commit 8c26ddf4a1
No known key found for this signature in database
GPG Key ID: 1E050E141B280628
3 changed files with 28 additions and 1 deletions

View File

@ -64,11 +64,12 @@ check_version:
- export IDF_PATH=$PWD
- tools/ci/check_idf_version.sh
check_rom_api_header:
check_api_usage:
extends: .pre_check_template
script:
- tools/ci/check_examples_rom_header.sh
- tools/ci/check_api_violation.sh
- tools/ci/check_examples_extra_component_dirs.sh
test_check_kconfigs:
extends: .pre_check_template

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -uo pipefail
# Examples shouldn't use EXTRA_COMPONENT_DIRS, instead the dependencies should be specified in idf_component.yml files
output=$(find ${IDF_PATH}/examples -name "CMakeLists.txt" -not -path "**/managed_components/**" -not -path "**/build/**")
files=$(egrep "set\(EXTRA_COMPONENT_DIRS" ${output} | cut -d ":" -f 1)
found_issues=0
for file in ${files}
do
if [ "$file" == "${IDF_PATH}/examples/system/unit_test/test/CMakeLists.txt" ]; then
# this specific one is okay
continue
fi
echo "${file} uses EXTRA_COMPONENT_DIRS. Change it to reference the component using idf_component.yml file."
((found_issues++))
done
if [ $found_issues -eq 0 ]; then
echo "No examples use EXTRA_COMPONENT_DIRS"
exit 0
fi
exit 1

View File

@ -55,6 +55,7 @@ tools/ci/check_callgraph.py
tools/ci/check_codeowners.py
tools/ci/check_deprecated_kconfigs.py
tools/ci/check_esp_memory_utils_headers.sh
tools/ci/check_examples_extra_component_dirs.sh
tools/ci/check_examples_rom_header.sh
tools/ci/check_executables.py
tools/ci/check_idf_version.sh