ci: travis: add coverity build job to be run from cron
authorStefan Schmidt <s.schmidt@samsung.com>
Tue, 25 Jun 2019 16:11:33 +0000 (12:11 -0400)
committerJongmin Lee <jm105.lee@samsung.com>
Wed, 26 Jun 2019 01:43:46 +0000 (10:43 +0900)
Summary:
We finally have regular Coverity Scan runs back to our CI.
It gets triggered from the cron jobs on Travis. As we are not able to
identify if it comes from a daily or weekly cron build I added a check
to only run the scan build on a Saturday so we should have a nice and
fresh report on Monday morning in our mailboxes.

Reviewers: zmike, bu5hm4n

Reviewed By: zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9175

.ci/ci-configure.sh
.ci/ci-make-benchmark.sh
.ci/ci-make-check.sh
.ci/ci-make-install.sh
.ci/ci-make.sh
.ci/coverity-tools-install.sh [new file with mode: 0755]
.ci/coverity-upload.sh [new file with mode: 0755]
.travis.yml

index 7802c6b..cc1f849 100755 (executable)
@@ -56,6 +56,17 @@ if [ "$DISTRO" != "" ] ; then
     OPTS="$OPTS $RELEASE_READY_LINUX_COPTS"
   fi
 
+  if [ "$1" = "coverity" ]; then
+    if [ $(date +%A) != "Saturday" ]; then
+      echo "Not Saturday so we are not running our weekly Coverity scan build."
+      exit 0
+    fi
+    OPTS="$OPTS $WAYLAND_LINUX_COPTS"
+    travis_fold cov-download cov-download
+    docker exec --env COVERITY_SCAN_TOKEN=$COVERITY_SCAN_TOKEN $(cat $HOME/cid) sh -c '.ci/coverity-tools-install.sh'
+    travis_endfold cov-download
+  fi
+
   if [ "$1" = "mingw" ]; then
     OPTS="$OPTS $MINGW_COPTS"
     travis_fold cross-native cross-native
@@ -65,6 +76,11 @@ if [ "$DISTRO" != "" ] ; then
     docker exec --env EIO_MONITOR_POLL=1 --env PKG_CONFIG_PATH="/ewpi-64-install/lib/pkgconfig/" \
        $(cat $HOME/cid) sh -c "mkdir build && meson build $OPTS"
     travis_endfold meson
+  elif [ "$1" = "coverity" ]; then
+    travis_fold meson meson
+    docker exec --env EIO_MONITOR_POLL=1 --env CFLAGS="-fdirectives-only"  --env CC="gcc" --env CXX="g++"\
+    --env CXXFLAGS="-fdirectives-only" $(cat $HOME/cid) sh -c "mkdir build && meson build $OPTS"
+    travis_endfold meson
   else
     travis_fold meson meson
     docker exec --env EIO_MONITOR_POLL=1 --env CC="ccache gcc" \
index d1689a2..1fe0f97 100755 (executable)
@@ -5,6 +5,9 @@ set -e
 if [ "$1" = "release-ready" ] ; then
   exit 0
 fi
+if [ "$1" = "coverity" ] ; then
+  exit 0
+fi
 travis_fold benchmark "ninja benchmark"
 echo "Nothing to do here, the benchmarks don't seem to terminate"
 #else
index d331993..36f1f2d 100755 (executable)
@@ -9,6 +9,10 @@ if [ "$1" = "mingw" ] ; then
   exit 0
 fi
 
+if [ "$1" = "coverity" ] ; then
+  exit 0
+fi
+
 #T7151
 if [ "$1" = "options-enabled" ] || [ "$1" = "options-disabled" ] ; then
   exit 0
index 0984b06..7476989 100755 (executable)
@@ -5,6 +5,9 @@ set -e
 if [ "$1" = "release-ready" ] ; then
   exit 0
 fi
+if [ "$1" = "coverity" ] ; then
+  exit 0
+fi
 travis_fold install "ninja install"
 if [ "$DISTRO" != "" ] ; then
   docker exec --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) ninja -C build install
index 0e955bc..70b5649 100755 (executable)
@@ -7,7 +7,16 @@ if [ "$1" = "release-ready" ] ; then
 fi
 travis_fold ninja ninja
 if [ "$DISTRO" != "" ] ; then
-  docker exec --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) ninja -C build
+  if [ "$1" = "coverity" ] ; then
+    if [ $(date +%A) != "Saturday" ]; then
+      exit 0
+    fi
+    docker exec --env EIO_MONITOR_POLL=1 --env PATH="/src/cov-analysis-linux64-2019.03/bin:$PATH" $(cat $HOME/cid) sh -c "cov-build --dir cov-int ninja -C build"
+    docker exec --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) sh -c "tar caf efl-$(git rev-parse --short HEAD).xz cov-int"
+    docker exec --env EIO_MONITOR_POLL=1 --env COVERITY_SCAN_TOKEN=$COVERITY_SCAN_TOKEN $(cat $HOME/cid) sh -c ".ci/coverity-upload.sh"
+  else
+    docker exec --env EIO_MONITOR_POLL=1 $(cat $HOME/cid) ninja -C build
+  fi
 else
   export PATH="$(brew --prefix gettext)/bin:$PATH"
   ninja -C build
diff --git a/.ci/coverity-tools-install.sh b/.ci/coverity-tools-install.sh
new file mode 100755 (executable)
index 0000000..08dd9d1
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+wget https://scan.coverity.com/download/linux64 --post-data="token=$COVERITY_SCAN_TOKEN&project=Enlightenment+Foundation+Libraries" -O coverity_tool.tgz
+tar xzf coverity_tool.tgz
diff --git a/.ci/coverity-upload.sh b/.ci/coverity-upload.sh
new file mode 100755 (executable)
index 0000000..0b68bcb
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+curl --form token=$COVERITY_SCAN_TOKEN \
+     --form email=stefan@datenfreihafen.org \
+     --form file=@efl-$(git rev-parse --short HEAD).xz \
+     --form version=$(git rev-parse --short HEAD) \
+     --form description="Submission from Travis CI" \
+     https://scan.coverity.com/builds?project=Enlightenment+Foundation+Libraries
index dbd3f6c..749f55d 100644 (file)
@@ -67,6 +67,9 @@ jobs:
     - os: linux
       if: type = cron
       env: DISTRO=Debian96
+    - os: linux
+      if: type = cron
+      env: DISTRO=Fedora30 CI_BUILD_TYPE=coverity
 
 services:
   - docker