Skip to content

Commit e523a43

Browse files
committed
CI: Decouple format checks
1 parent 37e68e0 commit e523a43

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

.ci/check-format.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#!/usr/bin/env bash
22

3-
SOURCES=$(find $(git rev-parse --show-toplevel) | egrep "\.(c|h)\$")
3+
SOURCES=$(find $(git rev-parse --show-toplevel) | egrep "\.(c|cxx|cpp|h|hpp)\$")
44

55
set -x
66

7-
exit $(clang-format --output-replacements-xml ${SOURCES} | egrep -c "</replacement>")
7+
for file in ${SOURCES};
8+
do
9+
clang-format-12 ${file} > expected-format
10+
diff -u -p --label="${file}" --label="expected coding style" ${file} expected-format
11+
done
12+
exit $(clang-format-12 --output-replacements-xml ${SOURCES} | egrep -c "</replacement>")

.github/workflows/main.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@ jobs:
1818
sudo apt-get update -q -y
1919
sudo apt-get install -q -y qemu-user
2020
sudo apt-get install -q -y build-essential
21-
sudo apt-get install -q -y clang-format
22-
sh .ci/check-format.sh
2321
make clean config ARCH=arm
2422
make check || exit 1
2523
make clean config ARCH=riscv
2624
make check || exit 1
25+
26+
coding_style:
27+
runs-on: ubuntu-22.04
28+
steps:
29+
- uses: actions/checkout@v3
30+
- name: coding convention
31+
run: |
32+
sudo apt-get install -q -y clang-format-12
33+
sh .ci/check-format.sh
34+
shell: bash

0 commit comments

Comments
 (0)