ci: add bash script to check if llama-impl.h was included in example folder erronously
This commit is contained in:
parent
4033365e00
commit
a444c15209
2 changed files with 12 additions and 16 deletions
6
Makefile
6
Makefile
|
@ -211,7 +211,7 @@ ifdef GGML_VULKAN
|
|||
BUILD_TARGETS += vulkan-shaders-gen
|
||||
endif
|
||||
|
||||
default: precompile_checks $(BUILD_TARGETS) $(LEGACY_TARGETS_BUILD)
|
||||
default: $(BUILD_TARGETS) $(LEGACY_TARGETS_BUILD)
|
||||
|
||||
test: $(TEST_TARGETS)
|
||||
@failures=0; \
|
||||
|
@ -248,10 +248,6 @@ test: $(TEST_TARGETS)
|
|||
|
||||
all: $(BUILD_TARGETS) $(TEST_TARGETS) $(LEGACY_TARGETS_BUILD)
|
||||
|
||||
# Run the forbidden includes check before every build
|
||||
precompile_checks:
|
||||
@bash ./scripts/precompile-checks.sh
|
||||
|
||||
ifdef RISCV_CROSS_COMPILE
|
||||
CC := riscv64-unknown-linux-gnu-gcc
|
||||
CXX := riscv64-unknown-linux-gnu-g++
|
||||
|
|
|
@ -11,23 +11,23 @@ SRC_DIR="./examples"
|
|||
FORBIDDEN_HEADERS=("llama-impl.h")
|
||||
echo "🔍 Scanning for forbidden includes in $SRC_DIR..."
|
||||
for HEADER in "${FORBIDDEN_HEADERS[@]}"; do
|
||||
MATCHES=$(grep -rn --include=\*.{c,cpp} "#include \"$HEADER\"" "$SRC_DIR" 2>/dev/null)
|
||||
MATCHES=$(grep -rn --include=\*.{c,cpp} "#include \"$HEADER\"" "$SRC_DIR" 2>/dev/null)
|
||||
|
||||
if [[ -n "$MATCHES" ]]; then
|
||||
echo "❌ Forbidden include detected: $HEADER"
|
||||
echo "$MATCHES" | while IFS=: read -r FILE LINE _; do
|
||||
echo "::error file=$FILE,line=$LINE::Forbidden include: $HEADER in $FILE at line $LINE"
|
||||
done
|
||||
ERROR_FOUND=1
|
||||
fi
|
||||
if [[ -n "$MATCHES" ]]; then
|
||||
echo "❌ Forbidden include detected: $HEADER"
|
||||
echo "$MATCHES" | while IFS=: read -r FILE LINE _; do
|
||||
echo "::error file=$FILE,line=$LINE::Forbidden include: $HEADER in $FILE at line $LINE"
|
||||
done
|
||||
ERROR_FOUND=1
|
||||
fi
|
||||
|
||||
done
|
||||
## END OF INCLUDES EXCLUDED FROM EXAMPLES FOLDER ##
|
||||
|
||||
|
||||
if [[ "$ERROR_FOUND" -eq 1 ]]; then
|
||||
echo "❌ Forbidden includes found. Please remove!"
|
||||
exit 1
|
||||
echo "❌ Forbidden includes found. Please remove!"
|
||||
exit 1
|
||||
else
|
||||
echo "✅ No forbidden includes found."
|
||||
echo "✅ No forbidden includes found."
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue