-
Notifications
You must be signed in to change notification settings - Fork 10
56 lines (44 loc) · 1.32 KB
/
formatting.yml
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Formatting
on:
push:
branches: [develop]
pull_request:
jobs:
clang-format:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -qq clang-format colordiff
- name: Run clang-format
run: |
before="${{ github.event.pull_request.base.sha }}"
if [ "$before" == "" ]; then
before="${{ github.event.before }}"
fi
diff=$(git-clang-format --diff --commit "$before")
[ "$diff" = "no modified files to format" ] && exit 0
[ "$diff" = "clang-format did not modify any files" ] && exit 0
printf "\033[1mYou have introduced coding style breakages, suggested changes:\n\n"
echo "$diff" | colordiff
exit 1
cmake-format:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -qq cmake-format
- name: Run cmake-format
run: |
cmake-format --check $(find ${{github.workspace}} -name CMakeLists.txt)
code=$?
if [[ $code != 0 ]]; then
exit 1
fi
exit 0