feat(CI): add cmake-format CI job

This commit is contained in:
Mayeul@Zama
2022-11-14 11:19:00 +01:00
committed by mayeul-zama
parent 84e0742fbe
commit fa3556e8cc
3 changed files with 25 additions and 0 deletions

View File

@@ -26,6 +26,8 @@ jobs:
token: ${{ secrets.GH_TOKEN }}
- name: Format with clang-format (Cpp)
run: sudo apt install moreutils && .github/workflows/scripts/format_cpp.sh
- name: Format with cmake-format (Cmake)
run: pip3 install cmakelang && .github/workflows/scripts/format_cmake.sh
- name: Format with black (Python)
run: |
cd compiler

12
.github/workflows/scripts/format_cmake.sh vendored Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
set -e -o pipefail
cmake-format -i compiler/CMakeLists.txt -c compiler/.cmake-format-config.py
find ./compiler/{include,lib,src,tests} -type f -name "CMakeLists.txt" | xargs -I % sh -c 'cmake-format -i % -c compiler/.cmake-format-config.py'
# show changes if any
git --no-pager diff
# fail if there is a diff, success otherwise
git diff | ifne exit 1