ci: add cmake_format check
This commit is contained in:
parent
bd8a111607
commit
2612a19f3c
2 changed files with 30 additions and 4 deletions
|
|
@ -88,6 +88,12 @@ steps:
|
|||
commands:
|
||||
- ./tools/ci/static_analysis/clang_format.sh
|
||||
|
||||
- name: cmake format
|
||||
image: ci:latest
|
||||
pull: if-not-exists
|
||||
commands:
|
||||
- ./tools/ci/static_analysis/cmake_format.sh
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
|
|
|
|||
20
tools/ci/static_analysis/cmake_format.sh
Executable file
20
tools/ci/static_analysis/cmake_format.sh
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
cd "$(git rev-parse --show-toplevel)/"
|
||||
|
||||
has_formatting_issues=0
|
||||
while IFS= read -r -d '' file; do
|
||||
echo "Checking format for $file"
|
||||
|
||||
if ! cmake-format --check "$file"; then
|
||||
echo "❌ Formatting issue detected in $file"
|
||||
has_formatting_issues=1
|
||||
fi
|
||||
done < <(find ./modules ./tools/cmake -type f \( -name 'CMakeLists.txt' -o -name '*.cmake' \) -print0)
|
||||
|
||||
if [ "$has_formatting_issues" -ne 0 ]; then
|
||||
echo "✅ All files are properly formatted! Well done! ^~^"
|
||||
fi
|
||||
|
||||
exit ${has_formatting_issues}
|
||||
Loading…
Add table
Reference in a new issue