summaryrefslogtreecommitdiff
path: root/.gitlab-ci
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2021-07-14 19:21:34 +0200
committerMarge Bot <marge-bot@gnome.org>2021-07-16 21:49:19 +0000
commit6203668b6c175d4782bc7a3fdc57a4a5f668e52f (patch)
tree1a33abc6013cfbf1a05e772152ec0fd1ce27610e /.gitlab-ci
parent37a6434a4d868ac6a8a137d4008c363a40a9c70d (diff)
downloadgnome-shell-6203668b6c175d4782bc7a3fdc57a4a5f668e52f.tar.gz
ci: Add job for pushing coverity reports
This job does: 1. Download the coverity bundle and untar it in a cached location 2. Build GNOME Shell using clang and the coverity tool 3. Compress the coverity report 4. Upload for analysis In a similar setup to that of Mutter. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1913>
Diffstat (limited to '.gitlab-ci')
-rwxr-xr-x.gitlab-ci/download-coverity-tarball.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/.gitlab-ci/download-coverity-tarball.sh b/.gitlab-ci/download-coverity-tarball.sh
new file mode 100755
index 000000000..e2afc5d55
--- /dev/null
+++ b/.gitlab-ci/download-coverity-tarball.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/bash
+
+# We need a coverity token to fetch the tarball
+if [ -x $COVERITY_TOKEN ]
+then
+ echo "No coverity token. Run this job from a protected branch."
+ exit -1
+fi
+
+mkdir -p coverity
+
+# Download and check MD5 first
+curl https://scan.coverity.com/download/linux64 \
+ --data "token=$COVERITY_TOKEN&project=GNOME+Shell&md5=1" \
+ --output /tmp/coverity_tool.md5
+
+diff /tmp/coverity_tool.md5 coverity/coverity_tool.md5 >/dev/null 2>&1
+
+if [ $? -eq 0 -a -d coverity/cov-analysis* ]
+then
+ echo "Coverity tarball is up-to-date"
+ exit 0
+fi
+
+# Download and extract coverity tarball
+curl https://scan.coverity.com/download/linux64 \
+ --data "token=$COVERITY_TOKEN&project=GNOME+Shell" \
+ --output /tmp/coverity_tool.tgz
+
+rm -rf ./coverity/cov-analysis*
+
+tar zxf /tmp/coverity_tool.tgz -C coverity/
+if [ $? -eq 0 ]
+then
+ mv /tmp/coverity_tool.md5 coverity/
+fi
+
+rm /tmp/coverity_tool.tgz