Debian Codegraph @

.github/workflows/codestyle.yml

raw symbols SCIP
1 name: Code Style
2
3 on:
4 push:
5 branches: [ master ]
6 pull_request:
7 branches: [ master ]
8
9 jobs:
10 build:
11
12 runs-on: ubuntu-latest
13
14 steps:
15 - uses: actions/checkout@v2
16 with:
17 fetch-depth: 0
18 - name: make patch
19 run: |
20 git format-patch -1 --stdout > current-commit.patch
21 - name: Run checkpatch
22 run: |
23 CHECKPATCH_SCRIPT="checkpatch.pl"
24 SPELLING_TXT="spelling.txt"
25 CONST_STRUCTS_TXT="const_structs.checkpatch"
26
27 KERNEL_RAW_URL="https://raw.githubusercontent.com/torvalds/linux/master"
28 CHECKPATCH_URL="${KERNEL_RAW_URL}/scripts/${CHECKPATCH_SCRIPT}"
29 SPELLING_URL="${KERNEL_RAW_URL}/scripts/${SPELLING_TXT}"
30 CONST_STRUCTS_URL="${KERNEL_RAW_URL}/scripts/${CONST_STRUCTS_TXT}"
31
32 for download in "${CHECKPATCH_URL}:${CHECKPATCH_SCRIPT}" "${SPELLING_URL}:${SPELLING_TXT}" "${CONST_STRUCTS_URL}:${CONST_STRUCTS_TXT}"; do
33 echo "Downloading '${download##*:}'..."
34 curl -f "${download%:*}" -s -S -O || \
35 exit 1
36 done
37
38 chmod 755 "${CHECKPATCH_SCRIPT}"
39 set +e
40 ./${CHECKPATCH_SCRIPT} --no-tree current-commit.patch >& codestyle.log
41 set -e
42 rm -rf current-commit.patch
43 echo "-------- Check Result ---------"
44 cat codestyle.log
45 error=$(cat codestyle.log | grep -i "total: .* errors, .* warnings," | awk '{print $2}')
46 rm -rf codestyle.log
47 test $error == 0 || exit 1