ci: add job performing static analysis on GitLab CI

Our GitHub Workflows definitions have a static analysis job that runs the following tasks: - Coccinelle to check for suggested refactorings. - `make hdr-check` to check for missing includes or forward declarations in our header files. - `make check-pot` to check our translations for issues. - `./ci/check-directional-formatting.bash` to check whether our sources contain any Unicode directional formatting code points. Add an equivalent job to our GitLab CI definitions. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Dec 28, 2023 at 12:02 UTC cd69c635a1a62b0c8bfdbf221778be8a512ad048
2 files changed +16 -1
.gitlab-ci.yml
+10
@@ -51,3 +51,13 @@ test:
51 paths:
52 - t/failed-test-artifacts
53 when: on_failure
54 +
55 +static-analysis:
56 + image: ubuntu:22.04
57 + variables:
58 + jobname: StaticAnalysis
59 + before_script:
60 + - ./ci/install-docker-dependencies.sh
61 + script:
62 + - ./ci/run-static-analysis.sh
63 + - ./ci/check-directional-formatting.bash
ci/install-docker-dependencies.sh
+6 -1
@@ -21,7 +21,7 @@ linux-musl)
21 apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
22 bash cvs gnupg perl-cgi perl-dbd-sqlite >/dev/null
23 ;;
24 -linux-*)
24 +linux-*|StaticAnalysis)
25 # Required so that apt doesn't wait for user input on certain packages.
26 export DEBIAN_FRONTEND=noninteractive
27
@@ -31,6 +31,11 @@ linux-*)
31 perl-modules liberror-perl libauthen-sasl-perl libemail-valid-perl \
32 libdbd-sqlite3-perl libio-socket-ssl-perl libnet-smtp-ssl-perl ${CC_PACKAGE:-${CC:-gcc}} \
33 apache2 cvs cvsps gnupg libcgi-pm-perl subversion
34 +
35 + if test "$jobname" = StaticAnalysis
36 + then
37 + apt install -q -y coccinelle
38 + fi
39 ;;
40 pedantic)
41 dnf -yq update >/dev/null &&