added coverity scan script

This commit is contained in:
Remy Marquis 2020-02-09 11:06:26 +01:00
parent 0ec9bc9e0c
commit 97b484ee6c

79
coverity/coverity.sh Normal file
View file

@ -0,0 +1,79 @@
#!/bin/bash
#
# Coverity scan script for https://scan.coverity.com/projects/etlegacy-etlegacy
# See https://scan.coverity.com/download
#
# Runs in the docker builder at etlegacy.com
#
# Folder structure:
# coverity.sh
# - etlegacy
# ... built code
# - github.com
# - etlegacy
# - etlegacy
# ... source code
# - coverity
# - etlegacy-cov
# - cov-analysis-linux64-2019.03
# - cov-int
#
topdir="$HOME/github.com/etlegacy"
srcdir="${topdir}/etlegacy"
covdir="${topdir}/coverity/etlegacy-cov"
covver="linux64-2019.03"
# account
token=xxxxxxxxxxxxxxxxxxxxxx
email=xxxxxxxxxxxx@xxxxx.xxx
# ensure we are on master branch
cd $srcdir
git stash
git checkout master
git pull
# cleanup
[[ -e $srcdir/build ]] && rm -rf $srcdir/build
# build
[[ ! -e $srcdir/build ]] && mkdir -p $srcdir/build
cd "$srcdir/build"
cmake .. \
-DCMAKE_BUILD_TYPE='Debug' \
-DCMAKE_INSTALL_PREFIX= \
-DCMAKE_LIBRARY_PATH=/usr/lib \
-DCMAKE_INCLUDE_PATH=/usr/include \
-DCROSS_COMPILE32=0 \
-DINSTALL_DEFAULT_BASEDIR=. \
-DINSTALL_DEFAULT_BINDIR=. \
-DINSTALL_DEFAULT_MODDIR=. \
-DBUNDLED_LIBS=1 \
-DINSTALL_EXTRA=0
# version check
version=$(git describe --always | sed -r 's/^v//;s/-/./g;')
version=${version:${#version} - 7}
# build
cd $HOME/$srcdir
$covdir/cov-analysis-${covver}/bin/cov-build --dir $covdir/cov-int make -j 4
cd $covdir
tar -czvf etlegacy-${version}.tgz cov-int
# upload
curl -k \
--form token=${token} \
--form email=${email} \
--form file=@etlegacy-${version}.tgz \
--form version="${version}" \
--form description="development" \
https://scan.coverity.com/builds?project=etlegacy%2Fetlegacy
# cleanup
rm ${covdir}/etlegacy-${version}.tgz
#[[ -e "${topdir}/coverity/cov-int" ]] && rm -rf "${covdir}/cov-int"
# vim:set ts=4 sw=2 et: