Skip to content

Commit 88660e7

Browse files
committed
Check formatting in CI
.github/workflows/build.yml: Use an Arch Linux container to check the formatting using clang-format.
1 parent b0b16ca commit 88660e7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@ on:
99
branches: [main]
1010

1111
jobs:
12+
check_formatting:
13+
runs-on: ubuntu-latest
14+
container:
15+
image: archlinux:latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Install dependencies
19+
run: pacman --noconfirm -Syu findutils git clang
20+
- name: Run clang-format on all C and C++ sources
21+
run: find . -type f -iname "*.c" -or -iname "*.cc" -or -iname "*.cpp" -or -iname "*.h" -exec clang-format -i {} \;
22+
- name: Check whether there are differences
23+
run: |
24+
if [[ -n "$(git status -s)" ]]; then
25+
printf "Files are not properly formatted!\n"
26+
git diff
27+
fi
1228
build_arch_linux_jack1:
1329
runs-on: ubuntu-latest
1430
container:

0 commit comments

Comments
 (0)