forked from redis/memtier_benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (31 loc) · 1 KB
/
code-style.yml
File metadata and controls
39 lines (31 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Code Style
on: [push, pull_request]
jobs:
cpp-format-check:
name: C++ Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Check C++ formatting
run: |
# Find all C++ source files
CPP_FILES=$(find . -name "*.cpp" -o -name "*.h" | grep -v deps/ | grep -v autom4te.cache/ | sort)
# Check formatting (dry-run)
FAILED=0
for file in $CPP_FILES; do
if ! clang-format --dry-run --Werror "$file" 2>/dev/null; then
echo "::error file=$file::File needs formatting: $file"
FAILED=1
fi
done
if [ $FAILED -eq 1 ]; then
echo ""
echo "Some files need formatting. Run locally:"
echo " make format"
exit 1
fi
echo "All C++ files are properly formatted!"