nightly builds + coverity scan (#4273)
* nightly + enable coverity * better releasing * coverity in travis * move var * start travis * remove quotes * Update coverity-scan.sh
Paweł Krupa committed
Sep 24, 2018 at 19:42 UTC
e3f1cdca076706564e07e86e0d0ac3e6d2471fe1
2 files changed
+42
-19
.travis.yml
+11
-4
@@ -12,7 +12,11 @@ stages:
12
- test
13
- build
14
- name: release
15
- if: branch = master AND type != pull_request
15
+ if: branch = master AND type = cron
16
+# TODO allow creating release on commit message
17
+# type = master AND \
18
+# type != pull_request AND \
19
+# ( type = cron OR commit_message =~ /[(major|minor|patch)]/ )
20
21
jobs:
22
include:
@@ -37,6 +41,10 @@ jobs:
41
# env: CFLAGS='-O1 -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -DNETDATA_INTERNAL_CHECKS=1 -D_FORTIFY_SOURCE=2 -DNETDATA_VERIFY_LOCKS=1'
42
# - name: "Node.js"
43
# script: tests/run_nodejs.sh
44
+ - name: "coverity"
45
+ script: ./coverity-scan.sh
46
+ env: INSTALL_COVERITY="true"
47
+ if: type = cron
48
- stage: "build"
49
name: "ubuntu 14.04 (not containerized)"
50
install: sudo apt-get install -y libcap2-bin zlib1g-dev uuid-dev fakeroot
@@ -52,8 +60,7 @@ jobs:
60
# script: ./.travis/containerized_build.sh alpine
61
- name: "OSX"
62
install: brew install fakeroot ossp-uuid
55
- script:
56
- - fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it
63
+ script: fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it
64
os: osx
65
- stage: "release"
66
name: "Docker"
@@ -61,7 +68,7 @@ jobs:
68
env: REPOSITORY="netdata/netdata"
69
- name: "GitHub"
70
install: sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot
64
- script: ./.travis/create_artifacts.sh
71
+ script: .travis/create_artifacts.sh
72
deploy:
73
- provider: releases
74
draft: true
coverity-scan.sh
+31
-15
@@ -1,25 +1,41 @@
1
#!/usr/bin/env bash
2
3
+# To run this script you need to provide API token. This can be done either by:
4
+# - Putting token in ".coverity-token" file
5
+# - Assigning token value to COVERITY_SCAN_TOKEN environment variable
6
+# Additionally script can install coverity tool on your computer. To do this just set environment variable INSTALL_COVERITY to "true"
7
+
8
cpus=$(grep -c ^processor </proc/cpuinfo)
9
[ -z "${cpus}" ] && cpus=1
10
11
token="${COVERITY_SCAN_TOKEN}"
12
([ -z "${token}" ] && [ -f .coverity-token ]) && token="$(<.coverity-token)"
8
-[ -z "${token}" ] && \
9
- echo >&2 "Save the coverity token to .coverity-token or export it as COVERITY_SCAN_TOKEN." && \
13
+if [ -z "${token}" ]; then
14
+ echo >&2 "Save the coverity token to .coverity-token or export it as COVERITY_SCAN_TOKEN."
15
exit 1
11
-
12
-# echo >&2 "Coverity token: ${token}"
16
+fi
17
18
covbuild="$(which cov-build 2>/dev/null || command -v cov-build 2>/dev/null)"
19
([ -z "${covbuild}" ] && [ -f .coverity-build ]) && covbuild="$(<.coverity-build)"
16
-[ -z "${covbuild}" ] && \
17
- echo "Save command the full filename of cov-build in .coverity-build" && \
18
- exit 1
19
-
20
-[ ! -x "${covbuild}" ] && \
21
- echo "The command ${covbuild} is not executable. Save command the full filename of cov-build in .coverity-build" && \
20
+if [ -z "${covbuild}" ]; then
21
+ echo "Cannot find 'cov-build' binary in \$PATH."
22
+ if [ $INSTALL_COVERITY != "" ]; then
23
+ echo "Installing coverity..."
24
+ mkdir /tmp/coverity
25
+ curl -SL --data "token=${token}&project=netdata%2Fnetdata" https://scan.coverity.com/download/linux64 > /tmp/coverity_tool.tar.gz
26
+ tar -x-C /tmp/coverity/ -f /tmp/coverity_tool.tar.gz
27
+ sudo mv /tmp/coverity/cov-analysis-linux64-2017.07 /opt/coverity
28
+ export PATH=${PATH}:/opt/coverity/bin/
29
+ else
30
+ echo "Save command the full filename of cov-build in .coverity-build"
31
+ exit 1
32
+ fi
33
+fi
34
+
35
+if [ ! -x "${covbuild}" ]; then
36
+ echo "The command ${covbuild} is not executable. Save command the full filename of cov-build in .coverity-build"
37
exit 1
38
+fi
39
40
version="$(grep "^#define PACKAGE_VERSION" config.h | cut -d '"' -f 2)"
41
echo >&2 "Working on netdata version: ${version}"
@@ -27,12 +43,12 @@ echo >&2 "Working on netdata version: ${version}"
43
echo >&2 "Cleaning up old builds..."
44
make clean || exit 1
45
30
-[ -d "cov-int" ] && \
31
- rm -rf "cov-int"
46
+[ -d "cov-int" ] && rm -rf "cov-int"
47
33
-[ -f netdata-coverity-analysis.tgz ] && \
34
- rm netdata-coverity-analysis.tgz
48
+[ -f netdata-coverity-analysis.tgz ] && rm netdata-coverity-analysis.tgz
49
50
+autoreconf -ivf
51
+./configure --enable-plugin-nfacct --enable-plugin-freeipmi
52
"${covbuild}" --dir cov-int make -j${cpus} || exit 1
53
54
echo >&2 "Compressing data..."
@@ -44,4 +60,4 @@ curl --progress-bar --form token="${token}" \
60
--form file=@netdata-coverity-analysis.tgz \
61
--form version="${version}" \
62
--form description="netdata, real-time performance monitoring, done right." \
47
- https://scan.coverity.com/builds?project=firehol%2Fnetdata
63
+ https://scan.coverity.com/builds?project=netdata%2Fnetdata