forked from OpenLightingProject/ola
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis-ci.sh
executable file
·321 lines (314 loc) · 14.1 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
#!/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"
PYCHECKER_BLACKLIST="threading,unittest,cmd,optparse,google,google.protobuf,ssl,fftpack,lapack_lite,mtrand"
SPELLINGBLACKLIST=$(cat <<-BLACKLIST
-wholename "./.codespellignorewords" -or \
-wholename "./.codespellignorelines" -or \
-wholename "./.git/*" -or \
-wholename "./aclocal.m4" -or \
-wholename "./config/config.guess" -or \
-wholename "./config/config.sub" -or \
-wholename "./config/depcomp" -or \
-wholename "./config/install-sh" -or \
-wholename "./config/libtool.m4" -or \
-wholename "./config/ltmain.sh" -or \
-wholename "./config/ltoptions.m4" -or \
-wholename "./config/ltsugar.m4" -or \
-wholename "./config/missing" -or \
-wholename "./libtool" -or \
-wholename "./config.log" -or \
-wholename "./config.status" -or \
-wholename "./Makefile" -or \
-wholename "./Makefile.in" -or \
-wholename "./autom4te.cache/*" -or \
-wholename "./java/Makefile" -or \
-wholename "./java/Makefile.in" -or \
-wholename "./olad/www/new/js/app.min.js" -or \
-wholename "./olad/www/new/js/app.min.js.map" -or \
-wholename "./olad/www/new/libs/angular/js/angular.min.js" -or \
-wholename "./olad/www/new/libs/marked/js/marked.min.js" -or \
-wholename "./olad/www/mobile.js" -or \
-wholename "./olad/www/ola.js" -or \
-wholename "./configure" -or \
-wholename "./common/protocol/Ola.pb.*" -or \
-wholename "./plugins/artnet/messages/ArtNetConfigMessages.pb.*" -or \
-wholename "./tools/ola_trigger/config.tab.*" -or \
-wholename "./tools/ola_trigger/lex.yy.cpp"
BLACKLIST
)
if [[ $TASK = 'lint' ]]; then
# run the lint tool only if it is the requested task
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
./configure --enable-rdm-tests --enable-ja-rule --enable-e133;
# 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
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "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
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests --enable-ja-rule --enable-e133;
travis_fold end "configure"
# 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
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
./scripts/enforce_licence.py
if [[ $? -ne 0 ]]; then
exit 1;
fi;
elif [[ $TASK = 'spellintian' ]]; then
# run spellintian only if it is the requested task, ignoring duplicate words
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests --enable-ja-rule --enable-e133;
travis_fold end "configure"
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for spellintian to run against
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
spellingfiles=$(eval "find ./ -type f -and ! \( \
$SPELLINGBLACKLIST \
\) | xargs")
# count the number of spellintian errors, ignoring duplicate words
spellingerrors=$(zrun spellintian $spellingfiles 2>&1 | grep -v "\(duplicate word\)" | wc -l)
if [[ $spellingerrors -ne 0 ]]; then
# print the output for info
zrun spellintian $spellingfiles | grep -v "\(duplicate word\)"
echo "Found $spellingerrors spelling errors via spellintian, ignoring duplicates"
exit 1;
else
echo "Found $spellingerrors spelling errors via spellintian, ignoring duplicates"
fi;
elif [[ $TASK = 'spellintian-duplicates' ]]; then
# run spellintian only if it is the requested task
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests --enable-ja-rule --enable-e133;
travis_fold end "configure"
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for spellintian to run against
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
spellingfiles=$(eval "find ./ -type f -and ! \( \
$SPELLINGBLACKLIST \
\) | xargs")
# count the number of spellintian errors
spellingerrors=$(zrun spellintian $spellingfiles 2>&1 | wc -l)
if [[ $spellingerrors -ne 0 ]]; then
# print the output for info
zrun spellintian $spellingfiles
echo "Found $spellingerrors spelling errors via spellintian"
exit 1;
else
echo "Found $spellingerrors spelling errors via spellintian"
fi;
elif [[ $TASK = 'codespell' ]]; then
# run codespell only if it is the requested task
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests --enable-ja-rule --enable-e133;
travis_fold end "configure"
# the following is a bit of a hack to build the files normally built during
# the build, so they are present for codespell to run against
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
spellingfiles=$(eval "find ./ -type f -and ! \( \
$SPELLINGBLACKLIST \
\) | xargs")
# count the number of codespell errors
spellingerrors=$(zrun codespell --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" --exclude-file .codespellignorelines --ignore-words .codespellignorewords $spellingfiles 2>&1 | wc -l)
if [[ $spellingerrors -ne 0 ]]; then
# print the output for info
zrun codespell --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" --exclude-file .codespellignorelines --ignore-words .codespellignorewords $spellingfiles
echo "Found $spellingerrors spelling errors via codespell"
exit 1;
else
echo "Found $spellingerrors spelling errors via codespell"
fi;
elif [[ $TASK = 'doxygen' ]]; then
# check doxygen only if it is the requested task
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
# Doxygen is C++ only, so don't bother with RDM tests
travis_fold start "configure"
./configure --enable-ja-rule --enable-e133;
travis_fold end "configure"
# 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
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "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
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
# Coverage is C++ only, so don't bother with RDM tests
travis_fold start "configure"
./configure --enable-gcov --enable-ja-rule --enable-e133;
travis_fold end "configure"
travis_fold start "make"
make;
travis_fold end "make"
travis_fold start "make_check"
make check;
travis_fold end "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;
travis_fold start "npm_install"
npm install;
travis_fold end "npm_install"
grunt test
elif [[ $TASK = 'flake8' ]]; then
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests;
travis_fold end "configure"
# 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
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
flake8 --max-line-length 80 --exclude *_pb2.py,.git,__pycache --ignore E111,E114,E121,E127,E129,W504 data/rdm include/ola python scripts tools/ola_mon tools/rdm
elif [[ $TASK = 'pychecker' ]]; then
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests;
travis_fold end "configure"
# 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
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
PYTHONPATH=./python/:$PYTHONPATH
export PYTHONPATH
mkdir ./python/ola/testing/
ln -s ./tools/rdm ./python/ola/testing/rdm
travis_fold start "pychecker_a"
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST $(find ./ -name "*.py" -and \( -wholename "./data/*" -or -wholename "./include/*" -or -wholename "./scripts/*" -or -wholename "./python/examples/rdm_compare.py" -or -wholename "./python/ola/*" \) -and ! \( -name "*_pb2.py" -or -name "OlaClient.py" -or -name "ola_candidate_ports.py" -or -wholename "./scripts/enforce_licence.py" -or -wholename "./python/ola/rpc/*" -or -wholename "./python/ola/ClientWrapper.py" -or -wholename "./python/ola/PidStore.py" -or -wholename "./python/ola/RDMAPI.py" \) | xargs)
travis_fold end "pychecker_a"
# More restricted checking for files that import files that break pychecker
travis_fold start "pychecker_b"
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST --only $(find ./ -name "*.py" -and \( -wholename "./tools/rdm/ModelCollector.py" -or -wholename "./tools/rdm/DMXSender.py" -or -wholename "./tools/rdm/TestCategory.py" -or -wholename "./tools/rdm/TestHelpers.py" -or -wholename "./tools/rdm/TestState.py" -or -wholename "./tools/rdm/TimingStats.py" -or -wholename "./tools/rdm/list_rdm_tests.py" \) | xargs)
travis_fold end "pychecker_b"
# Even more restricted checking for files that import files that break pychecker and have unused parameters
travis_fold start "pychecker_c"
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST --only --no-argsused $(find ./ -name "*.py" -and ! \( -name "*_pb2.py" -or -name "OlaClient.py" -or -name "ola_candidate_ports.py" -or -name "ola_universe_info.py" -or -name "rdm_snapshot.py" -or -name "ClientWrapper.py" -or -name "PidStore.py" -or -name "enforce_licence.py" -or -name "ola_mon.py" -or -name "TestLogger.py" -or -name "TestRunner.py" -or -name "rdm_model_collector.py" -or -name "rdm_responder_test.py" -or -name "rdm_test_server.py" \) | xargs)
travis_fold end "pychecker_c"
elif [[ $TASK = 'pychecker-wip' ]]; then
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure --enable-rdm-tests;
travis_fold end "configure"
# 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
travis_fold start "make_builtfiles"
make builtfiles;
travis_fold end "make_builtfiles"
PYTHONPATH=./python/:$PYTHONPATH
export PYTHONPATH
mkdir ./python/ola/testing/
ln -s ./tools/rdm ./python/ola/testing/rdm
pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST $(find ./ -name "*.py" -and ! \( -name "*_pb2.py" -or -name "OlaClient.py" -or -name "ola_candidate_ports.py" \) | xargs)
else
# Otherwise compile and check as normal
if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
# Silence all deprecated declarations on Linux due to auto_ptr making the build log too long
export DISTCHECK_CONFIGURE_FLAGS='--enable-rdm-tests --enable-java-libs --enable-ja-rule --enable-e133 CPPFLAGS=-Wno-deprecated-declarations'
else
export DISTCHECK_CONFIGURE_FLAGS='--enable-rdm-tests --enable-java-libs --enable-ja-rule --enable-e133'
fi
travis_fold start "autoreconf"
autoreconf -i;
travis_fold end "autoreconf"
travis_fold start "configure"
./configure $DISTCHECK_CONFIGURE_FLAGS;
travis_fold end "configure"
travis_fold start "make_distcheck"
make distcheck;
travis_fold end "make_distcheck"
travis_fold start "make_dist"
make dist;
travis_fold end "make_dist"
travis_fold start "verify_trees"
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
travis_fold end "verify_trees"
fi