diff --git a/coverity/coverity.sh b/coverity/coverity.sh new file mode 100644 index 0000000..1f2cbcb --- /dev/null +++ b/coverity/coverity.sh @@ -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: