Merge branch 'ci-validate-zap-common' into 'main'

CI: enforce zap common files validations when updating submodule

See merge request app-frameworks/esp-matter!1068
This commit is contained in:
Hrishikesh Dhayagude
2025-03-10 16:36:21 +08:00
+22 -7
View File
@@ -166,25 +166,40 @@ build_image:
- chip_head_in_readme=$(awk -F'[][]' '/commit \[.* of connectedhomeip/{print $2}' README.md)
# Check both conditions and collect errors
- commit_validation_error=0
- validation_error=0
- |
if echo "$chip_head_commit" | grep -q "^${chip_head_in_readme}"; then
echo "README.md is not in sync with the connectedhomeip submodule"
echo "README.md is in sync with the connectedhomeip submodule"
else
echo "Please update the README.md file with the latest commit hash of the connectedhomeip submodule"
commit_validation_error=1
echo "ERROR:Please update the README.md file with the latest commit hash of the connectedhomeip submodule"
validation_error=1
fi
- |
if echo "${chip_head_commit}" | grep -q "^${CHIP_SHORT_HASH}"; then
echo "The CHIP_SHORT_HASH variable is set to correct value. Matches with current head commit"
else
echo "The CHIP_SHORT_HASH seems to be incorrect or you have updated the submodule but not the CHIP_SHORT_HASH variable above"
commit_validation_error=1
echo "ERROR: The CHIP_SHORT_HASH seems to be incorrect or you have updated the submodule but not the CHIP_SHORT_HASH variable above"
validation_error=1
fi
# Validate if we have the latest ZAP common files
# python3 is not installed in dind image, so we need to install it
- apk add --no-cache python3
# update the submodule to so that script runs based on that submodule
- git submodule update --init --depth 1 connectedhomeip/connectedhomeip
- python3 components/esp_matter/zap_common/generate_zap_common_files.py
- |
if git diff --quiet components/esp_matter/zap_common; then
echo "ZAP common files are up to date."
else
echo "ERROR: ZAP common files are not up to date."
echo " Please run ./components/esp_matter/zap_common/generate_zap_common_files.py and commit the changes."
validation_error=1
fi
# Exit with collected error status
- if [ $commit_validation_error -ne 0 ]; then exit 1; fi
- if [ $validation_error -ne 0 ]; then exit 1; fi
- TAG="chip_${CHIP_SHORT_HASH}_idf_${IDF_VERSION}"
- echo $TAG