Skip to content

Commit

Permalink
nightly builds + coverity scan (netdata#4273)
Browse files Browse the repository at this point in the history
* nightly + enable coverity

* better releasing

* coverity in travis

* move var

* start travis

* remove quotes

* Update coverity-scan.sh
  • Loading branch information
paulfantom authored and ktsaou committed Sep 24, 2018
1 parent 12cc2b1 commit e3f1cdc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 19 deletions.
15 changes: 11 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ stages:
- test
- build
- name: release
if: branch = master AND type != pull_request
if: branch = master AND type = cron
# TODO allow creating release on commit message
# type = master AND \
# type != pull_request AND \
# ( type = cron OR commit_message =~ /[(major|minor|patch)]/ )

jobs:
include:
Expand All @@ -37,6 +41,10 @@ jobs:
# env: CFLAGS='-O1 -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -DNETDATA_INTERNAL_CHECKS=1 -D_FORTIFY_SOURCE=2 -DNETDATA_VERIFY_LOCKS=1'
# - name: "Node.js"
# script: tests/run_nodejs.sh
- name: "coverity"
script: ./coverity-scan.sh
env: INSTALL_COVERITY="true"
if: type = cron
- stage: "build"
name: "ubuntu 14.04 (not containerized)"
install: sudo apt-get install -y libcap2-bin zlib1g-dev uuid-dev fakeroot
Expand All @@ -52,16 +60,15 @@ jobs:
# script: ./.travis/containerized_build.sh alpine
- name: "OSX"
install: brew install fakeroot ossp-uuid
script:
- fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it
script: fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it
os: osx
- stage: "release"
name: "Docker"
script: docker/build.sh
env: REPOSITORY="netdata/netdata"
- name: "GitHub"
install: sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot
script: ./.travis/create_artifacts.sh
script: .travis/create_artifacts.sh
deploy:
- provider: releases
draft: true
Expand Down
46 changes: 31 additions & 15 deletions coverity-scan.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,54 @@
#!/usr/bin/env bash

# To run this script you need to provide API token. This can be done either by:
# - Putting token in ".coverity-token" file
# - Assigning token value to COVERITY_SCAN_TOKEN environment variable
# Additionally script can install coverity tool on your computer. To do this just set environment variable INSTALL_COVERITY to "true"

cpus=$(grep -c ^processor </proc/cpuinfo)
[ -z "${cpus}" ] && cpus=1

token="${COVERITY_SCAN_TOKEN}"
([ -z "${token}" ] && [ -f .coverity-token ]) && token="$(<.coverity-token)"
[ -z "${token}" ] && \
echo >&2 "Save the coverity token to .coverity-token or export it as COVERITY_SCAN_TOKEN." && \
if [ -z "${token}" ]; then
echo >&2 "Save the coverity token to .coverity-token or export it as COVERITY_SCAN_TOKEN."
exit 1

# echo >&2 "Coverity token: ${token}"
fi

covbuild="$(which cov-build 2>/dev/null || command -v cov-build 2>/dev/null)"
([ -z "${covbuild}" ] && [ -f .coverity-build ]) && covbuild="$(<.coverity-build)"
[ -z "${covbuild}" ] && \
echo "Save command the full filename of cov-build in .coverity-build" && \
exit 1

[ ! -x "${covbuild}" ] && \
echo "The command ${covbuild} is not executable. Save command the full filename of cov-build in .coverity-build" && \
if [ -z "${covbuild}" ]; then
echo "Cannot find 'cov-build' binary in \$PATH."
if [ $INSTALL_COVERITY != "" ]; then
echo "Installing coverity..."
mkdir /tmp/coverity
curl -SL --data "token=${token}&project=netdata%2Fnetdata" https://scan.coverity.com/download/linux64 > /tmp/coverity_tool.tar.gz
tar -x-C /tmp/coverity/ -f /tmp/coverity_tool.tar.gz
sudo mv /tmp/coverity/cov-analysis-linux64-2017.07 /opt/coverity
export PATH=${PATH}:/opt/coverity/bin/
else
echo "Save command the full filename of cov-build in .coverity-build"
exit 1
fi
fi

if [ ! -x "${covbuild}" ]; then
echo "The command ${covbuild} is not executable. Save command the full filename of cov-build in .coverity-build"
exit 1
fi

version="$(grep "^#define PACKAGE_VERSION" config.h | cut -d '"' -f 2)"
echo >&2 "Working on netdata version: ${version}"

echo >&2 "Cleaning up old builds..."
make clean || exit 1

[ -d "cov-int" ] && \
rm -rf "cov-int"
[ -d "cov-int" ] && rm -rf "cov-int"

[ -f netdata-coverity-analysis.tgz ] && \
rm netdata-coverity-analysis.tgz
[ -f netdata-coverity-analysis.tgz ] && rm netdata-coverity-analysis.tgz

autoreconf -ivf
./configure --enable-plugin-nfacct --enable-plugin-freeipmi
"${covbuild}" --dir cov-int make -j${cpus} || exit 1

echo >&2 "Compressing data..."
Expand All @@ -44,4 +60,4 @@ curl --progress-bar --form token="${token}" \
--form [email protected] \
--form version="${version}" \
--form description="netdata, real-time performance monitoring, done right." \
https://scan.coverity.com/builds?project=firehol%2Fnetdata
https://scan.coverity.com/builds?project=netdata%2Fnetdata

0 comments on commit e3f1cdc

Please sign in to comment.