Compare commits
1 Commits
98255ae3d3
...
59d1062733
| Author | SHA1 | Date | |
|---|---|---|---|
|
59d1062733
|
17
.github/workflows/main.yml
vendored
17
.github/workflows/main.yml
vendored
@@ -49,17 +49,20 @@ jobs:
|
||||
|
||||
- name: Run clang-format check
|
||||
run: |
|
||||
echo $(clang-format --version)
|
||||
# Find all source files you care about
|
||||
INCLUDE_REGEX='^.*\.((((c|C)(c|pp|xx|\+\+)?$)|((h|H)h?(pp|xx|\+\+)?$))|(ino|pde|proto|cu))$'
|
||||
CHECK_PATH='src'
|
||||
files=$(find "$CHECK_PATH" -name .git -prune -o -regextype posix-egrep -regex "$INCLUDE_REGEX" -print)
|
||||
if [ -z "$files" ]; then
|
||||
echo "✅ No source files found to check."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run clang-format in dry-run mode and collect any improperly formatted files
|
||||
failed=0
|
||||
for file in $files; do
|
||||
output=$(clang-format --dry-run --Werror --style=file "$file" 2>&1)
|
||||
status=$?
|
||||
if [ $status -ne 0 ]; then
|
||||
if ! output=$(clang-format --dry-run --Werror --style=file "$file" 2>&1); then
|
||||
echo "❌ Failed on file: $file"
|
||||
echo "$output"
|
||||
echo "----------------------------------------"
|
||||
@@ -67,8 +70,12 @@ jobs:
|
||||
fi
|
||||
done
|
||||
|
||||
# Exit with 1 if any formatting issues were found
|
||||
exit $failed
|
||||
if [ $failed -ne 0 ]; then
|
||||
echo "🚫 One or more files are not properly formatted."
|
||||
exit $failed
|
||||
else
|
||||
echo "✅ All files are properly formatted."
|
||||
fi
|
||||
|
||||
spell-check:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
Reference in New Issue
Block a user