chore: add hooks from furlang
This commit is contained in:
Executable
+28
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BUILD_DIR="build"
|
||||||
|
|
||||||
|
FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(cpp|hpp)$' | grep -v 'deps/' || true)
|
||||||
|
|
||||||
|
if [ -z "$FILES" ]; then
|
||||||
|
echo "No C/C++ files to check"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running clang-format..."
|
||||||
|
|
||||||
|
git diff -U0 --cached -- $FILES | \
|
||||||
|
python3 <(curl -s https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang/tools/clang-format/clang-format-diff.py) -p1 -i
|
||||||
|
|
||||||
|
echo "Running clang-tidy..."
|
||||||
|
|
||||||
|
for file in $FILES; do
|
||||||
|
clang-tidy \
|
||||||
|
"$file" \
|
||||||
|
--header-filter="^(?!.*deps/).*" \
|
||||||
|
-p "$BUILD_DIR"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "pre-commit checks passed"
|
||||||
Executable
+15
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BUILD_DIR="build"
|
||||||
|
|
||||||
|
echo "Building..."
|
||||||
|
|
||||||
|
cmake --build "$BUILD_DIR"
|
||||||
|
|
||||||
|
echo "Running tests..."
|
||||||
|
|
||||||
|
ctest --test-dir "$BUILD_DIR" --output-on-failure
|
||||||
|
|
||||||
|
echo "pre-push checks passed"
|
||||||
Reference in New Issue
Block a user