File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 4
4
branches : [ develop ]
5
5
6
6
jobs :
7
+ check-clang-format :
8
+ runs-on : ubuntu-20.04
9
+ steps :
10
+ - uses : actions/checkout@v2
11
+ with :
12
+ submodules : true
13
+ - name : Fetch dependencies
14
+ env :
15
+ # This is needed in addition to -yq to prevent apt-get from asking for
16
+ # user input
17
+ DEBIAN_FRONTEND : noninteractive
18
+ run : |
19
+ sudo apt-get install -yq clang-format-7
20
+ - name : Check updated lines of code match clang-format-7 style
21
+ env :
22
+ BASE_BRANCH : ${{ github.base_ref }}
23
+ PR_BRANCH : ${{ github.ref }}
24
+ run : |
25
+ echo "Pull request's base branch is: ${BASE_BRANCH}"
26
+ echo "Pull request's branch is: ${PR_BRANCH}"
27
+ clang-format-7 --version
28
+ while read file ; do EXCLUDES+="':(top,exclude)$file' " ; done < .clang-format-ignore
29
+ MERGE_BASE=$(git merge-base ${BASE_BRANCH} ${PR_BRANCH})
30
+ echo "Checking for formatting errors introduced since $MERGE_BASE"
31
+ # use eval so that quotes (as inserted into $EXCLUDES above) are not interpreted as parts of file names
32
+ eval git-clang-format-7 --binary clang-format-7 $MERGE_BASE -- $EXCLUDES
33
+ git diff > formatted.diff
34
+ if [[ -s formatted.diff ]] ; then
35
+ echo 'Formatting error! The following diff shows the required changes'
36
+ echo 'Use the raw log to get a version of the diff that preserves spacing'
37
+ cat formatted.diff
38
+ exit 1
39
+ fi
40
+ echo 'No formatting errors found'
41
+ exit 0
42
+
7
43
check-macos-10_15-cmake-clang :
8
44
runs-on : macos-10.15
9
45
steps :
You can’t perform that action at this time.
0 commit comments