travis_linux_script.sh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. #!/bin/bash
  2. set -e
  3. # Sonar code quality
  4. if ! [ -z ${SONAR+x} ]; then
  5. if ([ "${TRAVIS_REPO_SLUG}" != "open62541/open62541" ] ||
  6. [ "${TRAVIS_PULL_REQUEST}" != "false" ] ||
  7. [ "${TRAVIS_BRANCH}" != "master" ]); then
  8. echo "Skipping Sonarcloud on forks"
  9. # Skip on forks
  10. exit 0;
  11. fi
  12. git fetch --unshallow
  13. mkdir -p build && cd build
  14. build-wrapper-linux-x86-64 --out-dir ../bw-output cmake \
  15. -DCMAKE_BUILD_TYPE=Debug \
  16. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  17. -DUA_BUILD_EXAMPLES=ON \
  18. -DUA_ENABLE_DISCOVERY=ON \
  19. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  20. -DUA_ENABLE_ENCRYPTION .. \
  21. && make -j
  22. cd ..
  23. sonar-scanner
  24. exit 0
  25. fi
  26. # Docker build test
  27. if ! [ -z ${DOCKER+x} ]; then
  28. docker build -t open62541 .
  29. docker run -d -p 127.0.0.1:80:80 --name open62541 open62541 /bin/sh
  30. docker ps | grep -q open62541
  31. # disabled since it randomly fails
  32. # docker ps | grep -q open62541
  33. exit 0
  34. fi
  35. # Cpplint checking
  36. if ! [ -z ${LINT+x} ]; then
  37. mkdir -p build
  38. cd build
  39. cmake ..
  40. make cpplint
  41. if [ $? -ne 0 ] ; then exit 1 ; fi
  42. exit 0
  43. fi
  44. # Fuzzer build test
  45. if ! [ -z ${FUZZER+x} ]; then
  46. # Test the corpus generator and use new corpus for fuzz test
  47. ./tests/fuzz/generate_corpus.sh
  48. if [ $? -ne 0 ] ; then exit 1 ; fi
  49. cd build_fuzz
  50. make && make run_fuzzer
  51. if [ $? -ne 0 ] ; then exit 1 ; fi
  52. exit 0
  53. fi
  54. # INSTALL build test
  55. if ! [ -z ${INSTALL+x} ]; then
  56. echo "=== Install build, then compile examples ===" && echo -en 'travis_fold:start:script.build.install\\r'
  57. # Use make install to deploy files and then test if we can build the examples based on the installed files
  58. mkdir -p build
  59. cd build
  60. cmake \
  61. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  62. -DBUILD_SHARED_LIBS=ON \
  63. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  64. -DUA_NAMESPACE_ZERO=FULL \
  65. -DUA_ENABLE_AMALGAMATION=OFF \
  66. -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/open62541_install ..
  67. make -j install
  68. if [ $? -ne 0 ] ; then exit 1 ; fi
  69. cd .. && rm build -rf
  70. echo -en 'travis_fold:end:script.build.install\\r'
  71. echo -en 'travis_fold:start:script.build.mini-example\\r'
  72. # Now create a simple CMake Project which uses the installed file
  73. mkdir compile
  74. cp -r examples compile/examples && cd compile/examples
  75. cmake \
  76. -DCMAKE_PREFIX_PATH=$TRAVIS_BUILD_DIR/open62541_install \
  77. -DUA_NAMESPACE_ZERO=FULL .
  78. make -j
  79. if [ $? -ne 0 ] ; then exit 1 ; fi
  80. cd ../..
  81. rm -rf compile
  82. echo -en 'travis_fold:end:script.build.mini-example\\r'
  83. exit 0
  84. fi
  85. if ! [ -z ${CLANG_FORMAT+x} ]; then
  86. # Only run clang format on Pull requests, not on direct push
  87. if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
  88. echo -en "\\nSkipping clang-format on non-pull request\\n"
  89. exit 0
  90. fi
  91. echo "=== Running clang-format with diff against branch '$TRAVIS_BRANCH' ===" && echo -en 'travis_fold:start:script.clang-format\\r'
  92. # add clang-format-ci
  93. curl -Ls "https://raw.githubusercontent.com/llvm-mirror/clang/c510fac5695e904b43d5bf0feee31cc9550f110e/tools/clang-format/git-clang-format" -o "$LOCAL_PKG/bin/git-clang-format"
  94. chmod +x $LOCAL_PKG/bin/git-clang-format
  95. # Ignore files in the deps directory diff by resetting them to master
  96. git diff --name-only $TRAVIS_BRANCH | grep 'deps/*' | xargs git checkout $TRAVIS_BRANCH --
  97. # clang-format the diff to the target branch of the PR
  98. difference="$($LOCAL_PKG/bin/git-clang-format --style=file --diff $TRAVIS_BRANCH)"
  99. if ! case $difference in *"no modified files to format"*) false;; esac; then
  100. echo "====== clang-format did not find any issues. Well done! ======"
  101. exit 0
  102. fi
  103. if ! case $difference in *"clang-format did not modify any files"*) false;; esac; then
  104. echo "====== clang-format did not find any issues. Well done! ======"
  105. exit 0
  106. fi
  107. echo "====== clang-format Format Errors ======"
  108. echo "Uploading the patch to a pastebin page ..."
  109. pastebinUrl="$($LOCAL_PKG/bin/git-clang-format --style=file --diff $TRAVIS_BRANCH | curl -F 'sprunge=<-' http://sprunge.us)"
  110. echo "Created a patch file under: $pastebinUrl"
  111. echo "Please fix the following issues.\n\n"
  112. echo "You can also use the following command to apply the diff to your source locally:\n-------------\n"
  113. echo "curl -o format.patch $pastebinUrl && git apply format.patch\n-------------\n"
  114. echo "=============== DIFFERENCE - START =================\n"
  115. # We want to get colored diff output into the variable
  116. git config color.diff always
  117. $LOCAL_PKG/bin/git-clang-format --binary=clang-format-6.0 --style=file --diff $TRAVIS_BRANCH
  118. echo "\n============= DIFFERENCE - END ===================="
  119. echo -en 'travis_fold:start:script.clang-format\\r'
  120. exit 1
  121. fi
  122. if ! [ -z ${ANALYZE+x} ]; then
  123. echo "=== Running static code analysis ===" && echo -en 'travis_fold:start:script.analyze\\r'
  124. if ! case $CC in clang*) false;; esac; then
  125. mkdir -p build
  126. cd build
  127. scan-build-6.0 cmake \
  128. -DUA_BUILD_EXAMPLES=ON \
  129. -DUA_BUILD_UNIT_TESTS=ON ..
  130. scan-build-6.0 -enable-checker security.FloatLoopCounter \
  131. -enable-checker security.insecureAPI.UncheckedReturn \
  132. --status-bugs -v \
  133. make -j
  134. cd .. && rm build -rf
  135. mkdir -p build
  136. cd build
  137. scan-build-6.0 cmake \
  138. -DUA_ENABLE_PUBSUB=ON \
  139. -DUA_ENABLE_PUBSUB_DELTAFRAMES=ON \
  140. -DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON ..
  141. scan-build-6.0 -enable-checker security.FloatLoopCounter \
  142. -enable-checker security.insecureAPI.UncheckedReturn \
  143. --status-bugs -v \
  144. make -j
  145. cd .. && rm build -rf
  146. mkdir -p build
  147. cd build
  148. scan-build-6.0 cmake \
  149. -DUA_ENABLE_AMALGAMATION=OFF ..
  150. scan-build-6.0 -enable-checker security.FloatLoopCounter \
  151. -enable-checker security.insecureAPI.UncheckedReturn \
  152. --status-bugs -v \
  153. make -j
  154. cd .. && rm build -rf
  155. #mkdir -p build && cd build
  156. #cmake -DUA_ENABLE_STATIC_ANALYZER=REDUCED ..
  157. ## previous clang-format to reduce to non-trivial warnings
  158. #make clangformat
  159. #make
  160. #cd .. && rm build -rf
  161. else
  162. cppcheck --template "{file}({line}): {severity} ({id}): {message}" \
  163. --enable=style --force --std=c++11 -j 8 \
  164. --suppress=duplicateBranch \
  165. --suppress=incorrectStringBooleanError \
  166. --suppress=invalidscanf --inline-suppr \
  167. -I include src plugins examples 2> cppcheck.txt
  168. if [ -s cppcheck.txt ]; then
  169. echo "====== CPPCHECK Static Analysis Errors ======"
  170. cat cppcheck.txt
  171. # flush output
  172. sleep 5
  173. exit 1
  174. fi
  175. fi
  176. echo -en 'travis_fold:end:script.analyze\\r'
  177. exit 0
  178. fi
  179. echo -en "\r\n=== Building ===\r\n"
  180. echo -e "\r\n== Documentation build ==" && echo -en 'travis_fold:start:script.build.doc\\r'
  181. mkdir -p build
  182. cd build
  183. cmake \
  184. -DCMAKE_BUILD_TYPE=Release \
  185. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  186. -DUA_BUILD_EXAMPLES=ON ..
  187. make doc
  188. make doc_pdf
  189. cp -r doc ../../
  190. cp -r doc_latex ../../
  191. cd .. && rm build -rf
  192. echo -en 'travis_fold:end:script.build.doc\\r'
  193. # cross compilation only with gcc
  194. if ! [ -z ${MINGW+x} ]; then
  195. echo -e "\r\n== Cross compile release build for MinGW 32 bit ==" && echo -en 'travis_fold:start:script.build.cross_mingw32\\r'
  196. mkdir -p build && cd build
  197. cmake \
  198. -DBUILD_SHARED_LIBS=ON \
  199. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  200. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-win32 \
  201. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw32.cmake \
  202. -DUA_BUILD_EXAMPLES=ON \
  203. -DUA_ENABLE_AMALGAMATION=OFF ..
  204. make -j
  205. if [ $? -ne 0 ] ; then exit 1 ; fi
  206. make install
  207. if [ $? -ne 0 ] ; then exit 1 ; fi
  208. cd ..
  209. zip -r open62541-win32.zip ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-win32/*
  210. rm build -rf
  211. echo -en 'travis_fold:end:script.build.cross_mingw32\\r'
  212. echo -e "\r\n== Cross compile release build for MinGW 64 bit ==" && echo -en 'travis_fold:start:script.build.cross_mingw64\\r'
  213. mkdir -p build && cd build
  214. cmake \
  215. -DBUILD_SHARED_LIBS=ON \
  216. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  217. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-win64 \
  218. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw64.cmake \
  219. -DUA_BUILD_EXAMPLES=ON \
  220. -DUA_ENABLE_AMALGAMATION=OFF ..
  221. make -j
  222. if [ $? -ne 0 ] ; then exit 1 ; fi
  223. make install
  224. if [ $? -ne 0 ] ; then exit 1 ; fi
  225. cd ..
  226. zip -r open62541-win64.zip ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-win64/*
  227. rm build -rf
  228. echo -en 'travis_fold:end:script.build.cross_mingw64\\r'
  229. echo -e "\r\n== Cross compile release build for 32-bit linux ==" && echo -en 'travis_fold:start:script.build.cross_linux\\r'
  230. mkdir -p build && cd build
  231. cmake \
  232. -DBUILD_SHARED_LIBS=ON \
  233. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  234. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux32 \
  235. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-gcc-m32.cmake \
  236. -DUA_BUILD_EXAMPLES=ON \
  237. -DUA_ENABLE_AMALGAMATION=OFF ..
  238. make -j
  239. if [ $? -ne 0 ] ; then exit 1 ; fi
  240. make install
  241. if [ $? -ne 0 ] ; then exit 1 ; fi
  242. cd ..
  243. tar -pczf open62541-linux32.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-linux32/*
  244. rm build -rf
  245. echo -en 'travis_fold:end:script.build.cross_linux\\r'
  246. echo -e "\r\n== Cross compile release build for RaspberryPi ==" && echo -en 'travis_fold:start:script.build.cross_raspi\\r'
  247. mkdir -p build && cd build
  248. git clone https://github.com/raspberrypi/tools
  249. export PATH=$PATH:${TRAVIS_BUILD_DIR}/build/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/
  250. cmake \
  251. -DBUILD_SHARED_LIBS=ON \
  252. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  253. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-raspberrypi \
  254. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-rpi64.cmake \
  255. -DUA_BUILD_EXAMPLES=ON \
  256. -DUA_ENABLE_AMALGAMATION=OFF ..
  257. make -j
  258. if [ $? -ne 0 ] ; then exit 1 ; fi
  259. make install
  260. if [ $? -ne 0 ] ; then exit 1 ; fi
  261. cd ..
  262. tar -pczf open62541-raspberrypi.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-raspberrypi/*
  263. rm build -rf
  264. echo -en 'travis_fold:end:script.build.cross_raspi\\r'
  265. fi
  266. echo -e "\r\n== Compile release build for 64-bit linux ==" && echo -en 'travis_fold:start:script.build.linux_64\\r'
  267. mkdir -p build && cd build
  268. cmake \
  269. -DBUILD_SHARED_LIBS=ON \
  270. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  271. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux64 \
  272. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  273. -DUA_BUILD_EXAMPLES=ON \
  274. -DUA_ENABLE_AMALGAMATION=OFF ..
  275. make -j
  276. if [ $? -ne 0 ] ; then exit 1 ; fi
  277. make install
  278. if [ $? -ne 0 ] ; then exit 1 ; fi
  279. cd ..
  280. tar -pczf open62541-linux64.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-linux64/*
  281. rm build -rf
  282. echo -en 'travis_fold:end:script.build.linux_64\\r'
  283. echo -e "\r\n== Compile with amalgamation ==" && echo -en 'travis_fold:start:script.build.amalgamate\\r'
  284. mkdir -p build && cd build
  285. cmake \
  286. -DBUILD_SHARED_LIBS=ON \
  287. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  288. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux64 \
  289. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  290. -DUA_BUILD_EXAMPLES=OFF \
  291. -DUA_ENABLE_AMALGAMATION=ON \
  292. -DUA_ENABLE_HISTORIZING=ON ..
  293. make -j
  294. cp open62541.h ../.. # copy single file-release
  295. cp open62541.c ../.. # copy single file-release
  296. gcc -std=c99 -c open62541.c
  297. g++ ../examples/server.cpp -I./ open62541.o -lrt -o cpp-server
  298. if [ $? -ne 0 ] ; then exit 1 ; fi
  299. cd .. && rm build -rf
  300. echo -en 'travis_fold:end:script.build.amalgamate\\r'
  301. echo "Compile as shared lib version" && echo -en 'travis_fold:start:script.build.shared_libs\\r'
  302. mkdir -p build && cd build
  303. cmake \
  304. -DBUILD_SHARED_LIBS=ON \
  305. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  306. -DUA_BUILD_EXAMPLES=ON \
  307. -DUA_ENABLE_AMALGAMATION=OFF ..
  308. make -j
  309. if [ $? -ne 0 ] ; then exit 1 ; fi
  310. cd .. && rm build -rf
  311. echo -en 'travis_fold:end:script.build.shared_libs\\r'
  312. if [ "$CC" != "tcc" ]; then
  313. echo -e "\r\n==Compile multithreaded version==" && echo -en 'travis_fold:start:script.build.multithread\\r'
  314. mkdir -p build && cd build
  315. cmake \
  316. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  317. -DUA_BUILD_EXAMPLES=ON \
  318. -DUA_ENABLE_MULTITHREADING=ON ..
  319. make -j
  320. if [ $? -ne 0 ] ; then exit 1 ; fi
  321. cd .. && rm build -rf
  322. echo -en 'travis_fold:end:script.build.multithread\\r'
  323. fi
  324. echo -e "\r\n== Compile with encryption ==" && echo -en 'travis_fold:start:script.build.encryption\\r'
  325. mkdir -p build && cd build
  326. cmake \
  327. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  328. -DUA_BUILD_EXAMPLES=ON \
  329. -DUA_ENABLE_ENCRYPTION=ON ..
  330. make -j
  331. if [ $? -ne 0 ] ; then exit 1 ; fi
  332. cd .. && rm build -rf
  333. echo -en 'travis_fold:end:script.build.encryption\\r'
  334. echo -e "\r\n== Compile without discovery version ==" && echo -en 'travis_fold:start:script.build.discovery\\r'
  335. mkdir -p build && cd build
  336. cmake \
  337. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  338. -DUA_BUILD_EXAMPLES=ON \
  339. -DUA_ENABLE_DISCOVERY=OFF \
  340. -DUA_ENABLE_DISCOVERY_MULTICAST=OFF ..
  341. make -j
  342. if [ $? -ne 0 ] ; then exit 1 ; fi
  343. cd .. && rm build -rf
  344. echo -en 'travis_fold:end:script.build.discovery\\r'
  345. if [ "$CC" != "tcc" ]; then
  346. echo -e "\r\n== Compile multithreaded version with discovery ==" && echo -en 'travis_fold:start:script.build.multithread_discovery\\r'
  347. mkdir -p build && cd build
  348. cmake \
  349. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  350. -DUA_BUILD_EXAMPLES=ON \
  351. -DUA_ENABLE_DISCOVERY=ON \
  352. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  353. -DUA_ENABLE_MULTITHREADING=ON ..
  354. make -j
  355. if [ $? -ne 0 ] ; then exit 1 ; fi
  356. cd .. && rm build -rf
  357. echo -en 'travis_fold:end:script.build.multithread_discovery\\r'
  358. fi
  359. echo -e "\r\n== Compile JSON encoding ==" && echo -en 'travis_fold:start:script.build.json\\r'
  360. mkdir -p build && cd build
  361. cmake \
  362. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  363. -DUA_ENABLE_JSON_ENCODING=ON ..
  364. make -j
  365. if [ $? -ne 0 ] ; then exit 1 ; fi
  366. cd .. && rm build -rf
  367. echo -en 'travis_fold:end:script.build.json\\r'
  368. echo -e "\r\n== Unit tests (full NS0) ==" && echo -en 'travis_fold:start:script.build.unit_test_ns0_full\\r'
  369. mkdir -p build && cd build
  370. # Valgrind cannot handle the full NS0 because the generated file is too big. Thus run NS0 full without valgrind
  371. cmake \
  372. -DCMAKE_BUILD_TYPE=Debug \
  373. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  374. -DUA_BUILD_EXAMPLES=ON \
  375. -DUA_BUILD_UNIT_TESTS=ON \
  376. -DUA_ENABLE_COVERAGE=OFF \
  377. -DUA_ENABLE_DA=ON \
  378. -DUA_ENABLE_DISCOVERY=ON \
  379. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  380. -DUA_ENABLE_ENCRYPTION=ON \
  381. -DUA_ENABLE_JSON_ENCODING=ON \
  382. -DUA_ENABLE_PUBSUB=ON \
  383. -DUA_ENABLE_PUBSUB_DELTAFRAMES=ON \
  384. -DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON \
  385. -DUA_ENABLE_SUBSCRIPTIONS=ON \
  386. -DUA_ENABLE_SUBSCRIPTIONS_EVENTS=ON \
  387. -DUA_ENABLE_UNIT_TESTS_MEMCHECK=OFF \
  388. -DUA_NAMESPACE_ZERO=FULL ..
  389. make -j && make test ARGS="-V"
  390. if [ $? -ne 0 ] ; then exit 1 ; fi
  391. cd .. && rm build -rf
  392. echo -en 'travis_fold:end:script.build.unit_test_ns0_full\\r'
  393. if ! [ -z ${DEBIAN+x} ]; then
  394. echo -e "\r\n== Building the Debian package ==" && echo -en 'travis_fold:start:script.build.debian\\r'
  395. dpkg-buildpackage -b
  396. if [ $? -ne 0 ] ; then exit 1 ; fi
  397. cp ../open62541*.deb .
  398. # Copy for github release script
  399. cp ../open62541*.deb ../..
  400. echo -en 'travis_fold:end:script.build.debian\\r'
  401. fi
  402. if [ "$CC" != "tcc" ]; then
  403. echo -e "\r\n== Unit tests (minimal NS0) ==" && echo -en 'travis_fold:start:script.build.unit_test_ns0_minimal\\r'
  404. mkdir -p build && cd build
  405. cmake \
  406. -DCMAKE_BUILD_TYPE=Debug \
  407. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  408. -DUA_BUILD_EXAMPLES=ON \
  409. -DUA_BUILD_UNIT_TESTS=ON \
  410. -DUA_ENABLE_COVERAGE=ON \
  411. -DUA_ENABLE_DA=ON \
  412. -DUA_ENABLE_DISCOVERY=ON \
  413. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  414. -DUA_ENABLE_ENCRYPTION=ON \
  415. -DUA_ENABLE_JSON_ENCODING=ON \
  416. -DUA_ENABLE_PUBSUB=ON \
  417. -DUA_ENABLE_PUBSUB_DELTAFRAMES=ON \
  418. -DUA_ENABLE_PUBSUB_INFORMATIONMODEL=OFF \
  419. -DUA_ENABLE_UNIT_TESTS_MEMCHECK=ON \
  420. -DUA_NAMESPACE_ZERO=MINIMAL ..
  421. make -j && make test ARGS="-V"
  422. if [ $? -ne 0 ] ; then exit 1 ; fi
  423. cd .. && rm build -rf
  424. echo -en 'travis_fold:end:script.build.unit_test_ns0_minimal\\r'
  425. echo -e "\r\n== Unit tests (reduced NS0) ==" && echo -en 'travis_fold:start:script.build.unit_test_ns0_reduced\\r'
  426. mkdir -p build && cd build
  427. cmake \
  428. -DCMAKE_BUILD_TYPE=Debug \
  429. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  430. -DUA_BUILD_EXAMPLES=ON \
  431. -DUA_BUILD_UNIT_TESTS=ON \
  432. -DUA_ENABLE_COVERAGE=ON \
  433. -DUA_ENABLE_DA=ON \
  434. -DUA_ENABLE_DISCOVERY=ON \
  435. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  436. -DUA_ENABLE_ENCRYPTION=ON \
  437. -DUA_ENABLE_JSON_ENCODING=ON \
  438. -DUA_ENABLE_PUBSUB=ON \
  439. -DUA_ENABLE_PUBSUB_DELTAFRAMES=ON \
  440. -DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON \
  441. -DUA_ENABLE_UNIT_TESTS_MEMCHECK=ON \
  442. -DUA_NAMESPACE_ZERO=REDUCED ..
  443. make -j && make test ARGS="-V"
  444. if [ $? -ne 0 ] ; then exit 1 ; fi
  445. echo -en 'travis_fold:end:script.build.unit_test_ns0_reduced\\r'
  446. # only run coveralls on main repo and when MINGW=true
  447. # We only want to build coveralls once, so we just take the travis run where MINGW=true which is only enabled once
  448. echo -e "\r\n== -> Current repo: ${TRAVIS_REPO_SLUG} =="
  449. if [ $MINGW = "true" ] && [ "${TRAVIS_REPO_SLUG}" = "open62541/open62541" ]; then
  450. echo -en "\r\n== Building codecov.io for ${TRAVIS_REPO_SLUG} ==" && echo -en 'travis_fold:start:script.build.codecov\\r'
  451. cd ..
  452. /bin/bash -c "bash <(curl -s https://codecov.io/bash)"
  453. if [ $? -ne 0 ] ; then exit 1 ; fi
  454. cd build
  455. echo -en 'travis_fold:end:script.build.codecov\\r'
  456. echo -en "\r\n== Building coveralls for ${TRAVIS_REPO_SLUG} ==" && echo -en 'travis_fold:start:script.build.coveralls\\r'
  457. coveralls -E '.*/build/CMakeFiles/.*' -E '.*/examples/.*' -E '.*/tests/.*' -E '.*\.h' -E '.*CMakeCXXCompilerId\.cpp' -E '.*CMakeCCompilerId\.c' -r ../ || true # ignore result since coveralls is unreachable from time to time
  458. echo -en 'travis_fold:end:script.build.coveralls\\r'
  459. fi
  460. cd .. && rm build -rf
  461. fi