-
Notifications
You must be signed in to change notification settings - Fork 3
38 lines (29 loc) · 1.03 KB
/
codeformat.yml
File metadata and controls
38 lines (29 loc) · 1.03 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-Format Check
on:
# pull_request:
push:
branches:
- fix-it-if-you-have-faith
# - master
# - dev
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Clang-Format
run: sudo apt-get install -y clang-format-14
- name: Run Clang-Format Check
run: |
if [ ! -f .clang-format ]; then
echo "Error: .clang-format file not found!"
exit 1
fi
# Find all files to check.
FILES=$(find ./Holovibes -type f \( -name "*.hh" -o -name "*.cc" -o -name "*.cu" -o -name "*.cuh" -o -name "*.hxx" \) ! -name "*.cpp" ! -name "*.hpp")
# Check files and list non-conform files.
for FILE in $FILES; do
clang-format -style=file -assume-filename=.clang-format -output-replacements-xml $FILE | grep "<replacement " && echo "Formatting issues in $FILE" && exit 1
done
echo "All files are properly formatted."