ci: add cmake_format check
This commit is contained in:
parent
bd8a111607
commit
2612a19f3c
2 changed files with 30 additions and 4 deletions
14
.drone.yml
14
.drone.yml
|
|
@ -31,7 +31,7 @@ steps:
|
||||||
- ./tools/ci/amd64/gcc/unit_tests.sh
|
- ./tools/ci/amd64/gcc/unit_tests.sh
|
||||||
|
|
||||||
- name: valgrind
|
- name: valgrind
|
||||||
image: ci:latest
|
image: ci:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/amd64/gcc/valgrind.sh
|
- ./tools/ci/amd64/gcc/valgrind.sh
|
||||||
|
|
@ -55,7 +55,7 @@ steps:
|
||||||
- ./tools/ci/amd64/clang/coverage.sh
|
- ./tools/ci/amd64/clang/coverage.sh
|
||||||
|
|
||||||
- name: leak sanitizer
|
- name: leak sanitizer
|
||||||
image: ci:latest
|
image: ci:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/amd64/clang/lsan.sh
|
- ./tools/ci/amd64/clang/lsan.sh
|
||||||
|
|
@ -76,18 +76,24 @@ trigger:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: clang tidy
|
- name: clang tidy
|
||||||
image: ci:latest
|
image: ci:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
privileged: true
|
privileged: true
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/static_analysis/clang_tidy.sh
|
- ./tools/ci/static_analysis/clang_tidy.sh
|
||||||
|
|
||||||
- name: clang format
|
- name: clang format
|
||||||
image: ci:latest
|
image: ci:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/static_analysis/clang_format.sh
|
- ./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
|
kind: pipeline
|
||||||
type: docker
|
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