-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 1.63 KB
/
format.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
name: "C++/CMake Format"
on:
# always run on main branch
push:
branches: [ main ]
paths-ignore:
- 'README.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
# run on PR to main branch if relevant files changed
pull_request:
branches: [ main ]
paths:
- '**/*.cpp'
- '**/*.h'
- '**/CMakeLists.txt'
- '.github/workflows/format.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
format:
name: "clang-format/cmake-format"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: jirutka/setup-alpine@v1
with:
branch: v3.19
- name: Install dependencies
run: |
apk update
apk add \
clang-extra-tools \
py3-pip
pip install --break-system-packages cmake-format
shell: alpine.sh --root {0}
# Check all source and header C++ files; ignore files in hidden directories
- name: Execute clang-format
run: find . \( -path '*/.*' -prune \) -o
\( -type f -a \( -iname '*.cpp' -o -iname '*.h' \) \)
-exec echo "Format checking '{}'..." \;
-exec clang-format --dry-run --Werror --Wno-error=unknown {} +
shell: alpine.sh {0}
# Check all cmake files; ignore files in hidden directories
- name: Execute cmake-format
run: find . \( -path '*/.*' -prune \) -o
\( -type f -a -name 'CMakeLists.txt' \)
-exec echo "Format checking '{}'..." \;
-exec cmake-format --check -- {} +
shell: alpine.sh {0}