File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1010 - master
1111
1212jobs :
13+ clang-format-check :
14+ runs-on : macos-11
15+ steps :
16+ - name : Clone repository
17+ uses : actions/checkout@v3
18+ - name : Install clang-format
19+ run : |
20+ brew install clang-format
21+ clang-format --version
22+ - name : Run clang format check
23+ run : |
24+ bash scripts/check-clang.sh
25+
1326 mac-os-build-clang :
1427 runs-on : macos-12
1528 env :
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ if [[ -z $CLANG_FORMAT ]] ; then
4+ CLANG_FORMAT=clang-format
5+ fi
6+
7+ if NOT type $CLANG_FORMAT 2> /dev/null ; then
8+ echo " No appropriate clang-format found."
9+ exit 1
10+ fi
11+
12+ FAIL=0
13+ SOURCE_FILES=` find src samples tst -type f \( -name ' *.h' -o -name ' *.c' \) -not -path " */external/*" `
14+ echo " Performing clang format compliance check...."
15+ for i in $SOURCE_FILES
16+ do
17+ $CLANG_FORMAT -output-replacements-xml $i | grep -c " <replacement " > /dev/null
18+ if [ $? -ne 1 ]
19+ then
20+ echo " $i failed clang-format check."
21+ FAIL=1
22+ fi
23+ done
24+
25+ if [ $FAIL -ne 1 ]; then
26+ echo " Clang check passed for the project"
27+ fi
28+
29+ exit $FAIL
You can’t perform that action at this time.
0 commit comments