forked from OpenLightingProject/ola
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis-ci.sh
executable file
·125 lines (120 loc) · 4.75 KB
/
.travis-ci.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
# This script is triggered from the script section of .travis.yml
# It runs the appropriate commands depending on the task requested.
set -e
CPP_LINT_URL="https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py";
COVERITY_SCAN_BUILD_URL="https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh"
if [[ $TASK = 'lint' ]]; then
# run the lint tool only if it is the requested task
autoreconf -i;
./configure --enable-rdm-tests --enable-ja-rule;
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for linting to run against
make builtfiles
# first check we've not got any generic NOLINTs
# count the number of generic NOLINTs
nolints=$(grep -IR NOLINT * | grep -v "NOLINT(" | wc -l)
if [[ $nolints -ne 0 ]]; then
# print the output for info
echo $(grep -IR NOLINT * | grep -v "NOLINT(")
echo "Found $nolints generic NOLINTs"
exit 1;
else
echo "Found $nolints generic NOLINTs"
fi;
# then fetch and run the main cpplint tool
wget -O cpplint.py $CPP_LINT_URL;
chmod u+x cpplint.py;
./cpplint.py \
--filter=-legal/copyright,-readability/streams,-runtime/arrays \
$(find ./ \( -name "*.h" -or -name "*.cpp" \) -and ! \( \
-wholename "./common/protocol/Ola.pb.*" -or \
-wholename "./common/rpc/Rpc.pb.*" -or \
-wholename "./common/rpc/TestService.pb.*" -or \
-wholename "./common/rdm/Pids.pb.*" -or \
-wholename "./config.h" -or \
-wholename "./plugins/*/messages/*ConfigMessages.pb.*" -or \
-wholename "./tools/ola_trigger/config.tab.*" -or \
-wholename "./tools/ola_trigger/lex.yy.cpp" \) | xargs)
if [[ $? -ne 0 ]]; then
exit 1;
fi;
elif [[ $TASK = 'check-licences' ]]; then
# check licences only if it is the requested task
autoreconf -i;
./configure --enable-rdm-tests --enable-ja-rule;
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for licence checking to run against
make builtfiles
./scripts/enforce_licence.py
if [[ $? -ne 0 ]]; then
exit 1;
fi;
elif [[ $TASK = 'doxygen' ]]; then
# check doxygen only if it is the requested task
autoreconf -i;
# Doxygen is C++ only, so don't bother with RDM tests
./configure --enable-ja-rule;
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for Doxygen to run against
make builtfiles
# count the number of warnings
warnings=$(make doxygen-doc 2>&1 >/dev/null | wc -l)
if [[ $warnings -ne 0 ]]; then
# print the output for info
make doxygen-doc
echo "Found $warnings doxygen warnings"
exit 1;
else
echo "Found $warnings doxygen warnings"
fi;
elif [[ $TASK = 'coverage' ]]; then
# Compile with coverage for coveralls
autoreconf -i;
# Coverage is C++ only, so don't bother with RDM tests
./configure --enable-gcov --enable-ja-rule;
make;
make check;
elif [[ $TASK = 'coverity' ]]; then
# Run Coverity Scan unless token is zero length
# The Coverity Scan script also relies on a number of other COVERITY_SCAN_
# variables set in .travis.yml
if [[ ${#COVERITY_SCAN_TOKEN} -ne 0 ]]; then
curl -s $COVERITY_SCAN_BUILD_URL | bash
else
echo "Skipping Coverity Scan as no token found, probably a Pull Request"
fi;
elif [[ $TASK = 'jshint' ]]; then
cd ./javascript/new-src;
npm install;
grunt test
elif [[ $TASK = 'flake8' ]]; then
autoreconf -i;
./configure --enable-rdm-tests
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for flake8 to run against
make builtfiles
flake8 --max-line-length 80 --exclude *_pb2.py,.git,__pycache --ignore E111,E114,E121,E127,E129 data/rdm include/ola python scripts tools/ola_mon tools/rdm
elif [[ $TASK = 'pychecker' ]]; then
autoreconf -i;
./configure --enable-rdm-tests
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for pychecker to run against
make builtfiles
PYTHONPATH=./python/:$PYTHONPATH
export PYTHONPATH
mkdir ./python/ola/testing/
ln -s ./tools/rdm ./python/ola/testing/rdm
pychecker --quiet --limit 500 --blacklist threading,unittest,cmd,optparse,google,google.protobuf $(find ./ -name "*.py" -and ! -name "*_pb2.py" -and ! -name "OlaClient.py" -and ! -name "ola_candidate_ports.py" | xargs)
else
# Otherwise compile and check as normal
export DISTCHECK_CONFIGURE_FLAGS='--enable-rdm-tests --enable-ja-rule'
autoreconf -i;
./configure $DISTCHECK_CONFIGURE_FLAGS;
make distcheck;
make dist;
tarball=$(ls -Ut ola*.tar.gz | head -1)
tar -zxf $tarball;
tarball_root=$(echo $tarball | sed 's/.tar.gz$//')
./scripts/verify_trees.py ./ $tarball_root
fi