CI: misc cleanups + faster analysis (#449)
* switch to git ls-files to avoid picking up any other local .c files * enable assertions during static analysis since we used some assertions to disable/silence certain warnings. * update TCC commit hash to a more recent one * parallelize static analysis cppcheck already has -j argument to parallelize it's analysis and provide results faster, clang-tidy unfortunately doesn't. so use xargs -P to archive parallel execution. on my system this brings down the analysis time from ~27s to ~5s.
This commit is contained in:
parent
c03ec39437
commit
28018e92d3
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -16,7 +16,7 @@ jobs:
|
||||||
sudo apt-get install libimlib2 libimlib2-dev xserver-xorg-core xserver-xorg-dev \
|
sudo apt-get install libimlib2 libimlib2-dev xserver-xorg-core xserver-xorg-dev \
|
||||||
libxft2 libxft-dev libexif12 libexif-dev \
|
libxft2 libxft-dev libexif12 libexif-dev \
|
||||||
gcc clang git bc
|
gcc clang git bc
|
||||||
TCC_SHA="027b8fb9b88fe137447fb8bb1b61079be9702472"
|
TCC_SHA="29ae3ed4d5b83eec43598d6cd7949bccb41c8083"
|
||||||
wget "https://github.com/TinyCC/tinycc/archive/${TCC_SHA}.tar.gz" && tar xzf "${TCC_SHA}.tar.gz"
|
wget "https://github.com/TinyCC/tinycc/archive/${TCC_SHA}.tar.gz" && tar xzf "${TCC_SHA}.tar.gz"
|
||||||
( cd "tinycc-$TCC_SHA" && ./configure && make -j"$(nproc)" && sudo make install; )
|
( cd "tinycc-$TCC_SHA" && ./configure && make -j"$(nproc)" && sudo make install; )
|
||||||
- name: build
|
- name: build
|
||||||
|
|
|
@ -1,21 +1,24 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
std="c99"
|
std="c99"
|
||||||
|
NProc=$(( $(nproc) / 4 ))
|
||||||
|
if [ -z "$NProc" ] || [ "$NProc" -lt 1 ]; then NProc="1"; fi
|
||||||
|
|
||||||
run_cppcheck() {
|
run_cppcheck() {
|
||||||
cppcheck --std="$std" --enable=performance,portability \
|
cppcheck --std="$std" --enable=performance,portability \
|
||||||
--force --quiet --inline-suppr --error-exitcode=1 \
|
--force --quiet --inline-suppr --error-exitcode=1 \
|
||||||
--max-ctu-depth=8 -j"$(nproc)" \
|
--max-ctu-depth=8 -j"$NProc" \
|
||||||
$(make OPT_DEP_DEFAULT="$1" dump_cppflags) \
|
$(make OPT_DEP_DEFAULT="$1" dump_cppflags) -DDEBUG \
|
||||||
--suppress=varFuncNullUB --suppress=uninitvar \
|
--suppress=varFuncNullUB --suppress=uninitvar \
|
||||||
*.c
|
$(git ls-files *.c)
|
||||||
}
|
}
|
||||||
|
|
||||||
run_tidy() {
|
run_tidy() {
|
||||||
checks="$(sed '/^#/d' etc/woodpecker/clang-tidy-checks | paste -d ',' -s)"
|
checks="$(sed '/^#/d' etc/woodpecker/clang-tidy-checks | paste -d ',' -s)"
|
||||||
clang-tidy --warnings-as-errors="*" --checks="$checks" --quiet *.c \
|
git ls-files *.c | xargs -P"$NProc" -I{} clang-tidy --quiet \
|
||||||
-- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags)
|
--warnings-as-errors="*" --checks="$checks" {} \
|
||||||
|
-- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags) -DDEBUG
|
||||||
}
|
}
|
||||||
|
|
||||||
run_cppcheck "0"; run_cppcheck "1";
|
run_cppcheck "0" & run_cppcheck "1" & run_tidy "0" & run_tidy "1";
|
||||||
run_tidy "0"; run_tidy "1";
|
wait
|
||||||
|
|
|
@ -4,7 +4,7 @@ pipeline:
|
||||||
analysis:
|
analysis:
|
||||||
image: alpine
|
image: alpine
|
||||||
commands: |
|
commands: |
|
||||||
apk add --no-cache build-base cppcheck clang-extra-tools \
|
apk add --no-cache build-base cppcheck clang-extra-tools git \
|
||||||
imlib2-dev xorgproto \
|
imlib2-dev xorgproto \
|
||||||
libxft-dev libexif-dev giflib-dev libwebp-dev >/dev/null
|
libxft-dev libexif-dev giflib-dev libwebp-dev >/dev/null
|
||||||
make config.h version.h
|
make config.h version.h
|
||||||
|
|
|
@ -5,7 +5,7 @@ pipeline:
|
||||||
build:
|
build:
|
||||||
image: alpine
|
image: alpine
|
||||||
environment:
|
environment:
|
||||||
- TCC_SHA=027b8fb9b88fe137447fb8bb1b61079be9702472
|
- TCC_SHA=29ae3ed4d5b83eec43598d6cd7949bccb41c8083
|
||||||
commands: |
|
commands: |
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
imlib2 imlib2-dev xorgproto \
|
imlib2 imlib2-dev xorgproto \
|
||||||
|
|
Loading…
Reference in a new issue