travis_linux_script.sh 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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. # We want to get colored diff output into the variable
  96. git config color.diff always
  97. # Ignore files in the deps directory diff by resetting them to master
  98. git diff --name-only $TRAVIS_BRANCH | grep 'deps/*' | xargs git checkout $TRAVIS_BRANCH --
  99. # clang-format the diff to the target branch of the PR
  100. difference="$($LOCAL_PKG/bin/git-clang-format --style=file --diff $TRAVIS_BRANCH)"
  101. if ! case $difference in *"no modified files to format"*) false;; esac; then
  102. echo "====== clang-format did not find any issues. Well done! ======"
  103. exit 0
  104. fi
  105. echo "====== clang-format Format Errors ======"
  106. echo -e "Please fix the following issues:\n\n"
  107. echo "${difference}"
  108. echo -en 'travis_fold:start:script.clang-format\\r'
  109. exit 1
  110. fi
  111. if ! [ -z ${ANALYZE+x} ]; then
  112. echo "=== Running static code analysis ===" && echo -en 'travis_fold:start:script.analyze\\r'
  113. if ! case $CC in clang*) false;; esac; then
  114. mkdir -p build
  115. cd build
  116. scan-build-6.0 cmake \
  117. -DUA_BUILD_EXAMPLES=ON \
  118. -DUA_BUILD_UNIT_TESTS=ON ..
  119. scan-build-6.0 -enable-checker security.FloatLoopCounter \
  120. -enable-checker security.insecureAPI.UncheckedReturn \
  121. --status-bugs -v \
  122. make -j
  123. cd .. && rm build -rf
  124. mkdir -p build
  125. cd build
  126. scan-build-6.0 cmake \
  127. -DUA_ENABLE_PUBSUB=ON \
  128. -DUA_ENABLE_PUBSUB_DELTAFRAMES=ON \
  129. -DUA_ENABLE_PUBSUB_INFORMATIONMODEL=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_AMALGAMATION=OFF ..
  139. scan-build-6.0 -enable-checker security.FloatLoopCounter \
  140. -enable-checker security.insecureAPI.UncheckedReturn \
  141. --status-bugs -v \
  142. make -j
  143. cd .. && rm build -rf
  144. #mkdir -p build && cd build
  145. #cmake -DUA_ENABLE_STATIC_ANALYZER=REDUCED ..
  146. ## previous clang-format to reduce to non-trivial warnings
  147. #make clangformat
  148. #make
  149. #cd .. && rm build -rf
  150. else
  151. cppcheck --template "{file}({line}): {severity} ({id}): {message}" \
  152. --enable=style --force --std=c++11 -j 8 \
  153. --suppress=duplicateBranch \
  154. --suppress=incorrectStringBooleanError \
  155. --suppress=invalidscanf --inline-suppr \
  156. -I include src plugins examples 2> cppcheck.txt
  157. if [ -s cppcheck.txt ]; then
  158. echo "====== CPPCHECK Static Analysis Errors ======"
  159. cat cppcheck.txt
  160. # flush output
  161. sleep 5
  162. exit 1
  163. fi
  164. fi
  165. echo -en 'travis_fold:end:script.analyze\\r'
  166. exit 0
  167. fi
  168. echo -en "\r\n=== Building ===\r\n"
  169. echo -e "\r\n== Documentation and certificate build ==" && echo -en 'travis_fold:start:script.build.doc\\r'
  170. mkdir -p build
  171. cd build
  172. cmake \
  173. -DCMAKE_BUILD_TYPE=Release \
  174. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  175. -DUA_BUILD_EXAMPLES=ON \
  176. -DUA_BUILD_SELFSIGNED_CERTIFICATE=ON ..
  177. make doc
  178. make doc_pdf
  179. make selfsigned
  180. cp -r doc ../../
  181. cp -r doc_latex ../../
  182. cp ./examples/server_cert.der ../../
  183. cd .. && rm build -rf
  184. echo -en 'travis_fold:end:script.build.doc\\r'
  185. # cross compilation only with gcc
  186. if ! [ -z ${MINGW+x} ]; then
  187. echo -e "\r\n== Cross compile release build for MinGW 32 bit ==" && echo -en 'travis_fold:start:script.build.cross_mingw32\\r'
  188. mkdir -p build && cd build
  189. cmake \
  190. -DBUILD_SHARED_LIBS=ON \
  191. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  192. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-win32 \
  193. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw32.cmake \
  194. -DUA_BUILD_EXAMPLES=ON \
  195. -DUA_ENABLE_AMALGAMATION=OFF ..
  196. make -j
  197. if [ $? -ne 0 ] ; then exit 1 ; fi
  198. make install
  199. if [ $? -ne 0 ] ; then exit 1 ; fi
  200. cd ..
  201. zip -r open62541-win32.zip ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-win32/*
  202. rm build -rf
  203. echo -en 'travis_fold:end:script.build.cross_mingw32\\r'
  204. echo -e "\r\n== Cross compile release build for MinGW 64 bit ==" && echo -en 'travis_fold:start:script.build.cross_mingw64\\r'
  205. mkdir -p build && cd build
  206. cmake \
  207. -DBUILD_SHARED_LIBS=ON \
  208. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  209. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-win64 \
  210. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw64.cmake \
  211. -DUA_BUILD_EXAMPLES=ON \
  212. -DUA_ENABLE_AMALGAMATION=OFF ..
  213. make -j
  214. if [ $? -ne 0 ] ; then exit 1 ; fi
  215. make install
  216. if [ $? -ne 0 ] ; then exit 1 ; fi
  217. cd ..
  218. zip -r open62541-win64.zip ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-win64/*
  219. rm build -rf
  220. echo -en 'travis_fold:end:script.build.cross_mingw64\\r'
  221. echo -e "\r\n== Cross compile release build for 32-bit linux ==" && echo -en 'travis_fold:start:script.build.cross_linux\\r'
  222. mkdir -p build && cd build
  223. cmake \
  224. -DBUILD_SHARED_LIBS=ON \
  225. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  226. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux32 \
  227. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-gcc-m32.cmake \
  228. -DUA_BUILD_EXAMPLES=ON \
  229. -DUA_ENABLE_AMALGAMATION=OFF ..
  230. make -j
  231. if [ $? -ne 0 ] ; then exit 1 ; fi
  232. make install
  233. if [ $? -ne 0 ] ; then exit 1 ; fi
  234. cd ..
  235. tar -pczf open62541-linux32.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-linux32/*
  236. rm build -rf
  237. echo -en 'travis_fold:end:script.build.cross_linux\\r'
  238. echo -e "\r\n== Cross compile release build for RaspberryPi ==" && echo -en 'travis_fold:start:script.build.cross_raspi\\r'
  239. mkdir -p build && cd build
  240. git clone https://github.com/raspberrypi/tools
  241. export PATH=$PATH:${TRAVIS_BUILD_DIR}/build/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/
  242. cmake \
  243. -DBUILD_SHARED_LIBS=ON \
  244. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  245. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-raspberrypi \
  246. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-rpi64.cmake \
  247. -DUA_BUILD_EXAMPLES=ON \
  248. -DUA_ENABLE_AMALGAMATION=OFF ..
  249. make -j
  250. if [ $? -ne 0 ] ; then exit 1 ; fi
  251. make install
  252. if [ $? -ne 0 ] ; then exit 1 ; fi
  253. cd ..
  254. tar -pczf open62541-raspberrypi.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-raspberrypi/*
  255. rm build -rf
  256. echo -en 'travis_fold:end:script.build.cross_raspi\\r'
  257. fi
  258. echo -e "\r\n== Compile release build for 64-bit linux ==" && echo -en 'travis_fold:start:script.build.linux_64\\r'
  259. mkdir -p build && cd build
  260. cmake \
  261. -DBUILD_SHARED_LIBS=ON \
  262. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  263. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux64 \
  264. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  265. -DUA_BUILD_EXAMPLES=ON \
  266. -DUA_ENABLE_AMALGAMATION=OFF ..
  267. make -j
  268. if [ $? -ne 0 ] ; then exit 1 ; fi
  269. make install
  270. if [ $? -ne 0 ] ; then exit 1 ; fi
  271. cd ..
  272. tar -pczf open62541-linux64.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-linux64/*
  273. rm build -rf
  274. echo -en 'travis_fold:end:script.build.linux_64\\r'
  275. echo -e "\r\n== Compile with amalgamation ==" && echo -en 'travis_fold:start:script.build.amalgamate\\r'
  276. mkdir -p build && cd build
  277. cmake \
  278. -DBUILD_SHARED_LIBS=ON \
  279. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  280. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux64 \
  281. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  282. -DUA_BUILD_EXAMPLES=OFF \
  283. -DUA_ENABLE_AMALGAMATION=ON ..
  284. make -j
  285. cp open62541.h ../.. # copy single file-release
  286. cp open62541.c ../.. # copy single file-release
  287. gcc -std=c99 -c open62541.c
  288. g++ ../examples/server.cpp -I./ open62541.o -lrt -o cpp-server
  289. if [ $? -ne 0 ] ; then exit 1 ; fi
  290. cd .. && rm build -rf
  291. echo -en 'travis_fold:end:script.build.amalgamate\\r'
  292. echo "Compile as shared lib version" && echo -en 'travis_fold:start:script.build.shared_libs\\r'
  293. mkdir -p build && cd build
  294. cmake \
  295. -DBUILD_SHARED_LIBS=ON \
  296. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  297. -DUA_BUILD_EXAMPLES=ON \
  298. -DUA_ENABLE_AMALGAMATION=OFF ..
  299. make -j
  300. if [ $? -ne 0 ] ; then exit 1 ; fi
  301. cd .. && rm build -rf
  302. echo -en 'travis_fold:end:script.build.shared_libs\\r'
  303. echo "Compile as shared lib version with amalgamation" && echo -en 'travis_fold:start:script.build.shared_libs_amalgamate\\r'
  304. mkdir -p build && cd build
  305. cmake \
  306. -DBUILD_SHARED_LIBS=ON \
  307. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  308. -DUA_BUILD_EXAMPLES=OFF \
  309. -DUA_ENABLE_AMALGAMATION=ON ..
  310. make -j
  311. if [ $? -ne 0 ] ; then exit 1 ; fi
  312. cd .. && rm build -rf
  313. echo -en 'travis_fold:end:script.build.shared_libs_amalgamate\\r'
  314. if [ "$CC" != "tcc" ]; then
  315. echo -e "\r\n==Compile multithreaded version==" && echo -en 'travis_fold:start:script.build.multithread\\r'
  316. mkdir -p build && cd build
  317. cmake \
  318. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  319. -DUA_BUILD_EXAMPLES=ON \
  320. -DUA_ENABLE_MULTITHREADING=ON ..
  321. make -j
  322. if [ $? -ne 0 ] ; then exit 1 ; fi
  323. cd .. && rm build -rf
  324. echo -en 'travis_fold:end:script.build.multithread\\r'
  325. fi
  326. echo -e "\r\n== Compile with encryption ==" && echo -en 'travis_fold:start:script.build.encryption\\r'
  327. mkdir -p build && cd build
  328. cmake \
  329. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  330. -DUA_BUILD_EXAMPLES=ON \
  331. -DUA_ENABLE_ENCRYPTION=ON ..
  332. make -j
  333. if [ $? -ne 0 ] ; then exit 1 ; fi
  334. cd .. && rm build -rf
  335. echo -en 'travis_fold:end:script.build.encryption\\r'
  336. echo -e "\r\n== Compile without discovery version ==" && echo -en 'travis_fold:start:script.build.discovery\\r'
  337. mkdir -p build && cd build
  338. cmake \
  339. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  340. -DUA_BUILD_EXAMPLES=ON \
  341. -DUA_ENABLE_DISCOVERY=OFF \
  342. -DUA_ENABLE_DISCOVERY_MULTICAST=OFF ..
  343. make -j
  344. if [ $? -ne 0 ] ; then exit 1 ; fi
  345. cd .. && rm build -rf
  346. echo -en 'travis_fold:end:script.build.discovery\\r'
  347. if [ "$CC" != "tcc" ]; then
  348. echo -e "\r\n== Compile multithreaded version with discovery ==" && echo -en 'travis_fold:start:script.build.multithread_discovery\\r'
  349. mkdir -p build && cd build
  350. cmake \
  351. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  352. -DUA_BUILD_EXAMPLES=ON \
  353. -DUA_ENABLE_DISCOVERY=ON \
  354. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  355. -DUA_ENABLE_MULTITHREADING=ON ..
  356. make -j
  357. if [ $? -ne 0 ] ; then exit 1 ; fi
  358. cd .. && rm build -rf
  359. echo -en 'travis_fold:end:script.build.multithread_discovery\\r'
  360. fi
  361. echo -e "\r\n== Compile JSON encoding ==" && echo -en 'travis_fold:start:script.build.json\\r'
  362. mkdir -p build && cd build
  363. cmake \
  364. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  365. -DUA_ENABLE_JSON_ENCODING=ON ..
  366. make -j
  367. if [ $? -ne 0 ] ; then exit 1 ; fi
  368. cd .. && rm build -rf
  369. echo -en 'travis_fold:end:script.build.json\\r'
  370. echo -e "\r\n== Unit tests (full NS0) ==" && echo -en 'travis_fold:start:script.build.unit_test_ns0_full\\r'
  371. mkdir -p build && cd build
  372. # Valgrind cannot handle the full NS0 because the generated file is too big. Thus run NS0 full without valgrind
  373. cmake \
  374. -DCMAKE_BUILD_TYPE=Debug \
  375. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  376. -DUA_BUILD_EXAMPLES=ON \
  377. -DUA_BUILD_UNIT_TESTS=ON \
  378. -DUA_ENABLE_COVERAGE=OFF \
  379. -DUA_ENABLE_DA=ON \
  380. -DUA_ENABLE_DISCOVERY=ON \
  381. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  382. -DUA_ENABLE_ENCRYPTION=ON \
  383. -DUA_ENABLE_JSON_ENCODING=ON \
  384. -DUA_ENABLE_PUBSUB=ON \
  385. -DUA_ENABLE_PUBSUB_DELTAFRAMES=ON \
  386. -DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON \
  387. -DUA_ENABLE_SUBSCRIPTIONS=ON \
  388. -DUA_ENABLE_SUBSCRIPTIONS_EVENTS=ON \
  389. -DUA_ENABLE_UNIT_TESTS_MEMCHECK=OFF \
  390. -DUA_NAMESPACE_ZERO=FULL ..
  391. make -j && make test ARGS="-V"
  392. if [ $? -ne 0 ] ; then exit 1 ; fi
  393. cd .. && rm build -rf
  394. echo -en 'travis_fold:end:script.build.unit_test_ns0_full\\r'
  395. if ! [ -z ${DEBIAN+x} ]; then
  396. echo -e "\r\n== Building the Debian package ==" && echo -en 'travis_fold:start:script.build.debian\\r'
  397. dpkg-buildpackage -b
  398. if [ $? -ne 0 ] ; then exit 1 ; fi
  399. cp ../open62541*.deb .
  400. # Copy for github release script
  401. cp ../open62541*.deb ../..
  402. echo -en 'travis_fold:end:script.build.debian\\r'
  403. fi
  404. if [ "$CC" != "tcc" ]; then
  405. echo -e "\r\n== Unit tests (minimal NS0) ==" && echo -en 'travis_fold:start:script.build.unit_test_ns0_minimal\\r'
  406. mkdir -p build && cd build
  407. cmake \
  408. -DCMAKE_BUILD_TYPE=Debug \
  409. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  410. -DUA_BUILD_EXAMPLES=ON \
  411. -DUA_BUILD_UNIT_TESTS=ON \
  412. -DUA_ENABLE_COVERAGE=ON \
  413. -DUA_ENABLE_DA=ON \
  414. -DUA_ENABLE_DISCOVERY=ON \
  415. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  416. -DUA_ENABLE_ENCRYPTION=ON \
  417. -DUA_ENABLE_JSON_ENCODING=ON \
  418. -DUA_ENABLE_PUBSUB=ON \
  419. -DUA_ENABLE_PUBSUB_DELTAFRAMES=ON \
  420. -DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON \
  421. -DUA_ENABLE_UNIT_TESTS_MEMCHECK=ON ..
  422. make -j && make test ARGS="-V"
  423. if [ $? -ne 0 ] ; then exit 1 ; fi
  424. echo -en 'travis_fold:end:script.build.unit_test_ns0_minimal\\r'
  425. # only run coveralls on main repo and when MINGW=true
  426. # We only want to build coveralls once, so we just take the travis run where MINGW=true which is only enabled once
  427. echo -e "\r\n== -> Current repo: ${TRAVIS_REPO_SLUG} =="
  428. if [ $MINGW = "true" ] && [ "${TRAVIS_REPO_SLUG}" = "open62541/open62541" ]; then
  429. echo -en "\r\n== Building codecov.io for ${TRAVIS_REPO_SLUG} ==" && echo -en 'travis_fold:start:script.build.codecov\\r'
  430. cd ..
  431. /bin/bash -c "bash <(curl -s https://codecov.io/bash)"
  432. if [ $? -ne 0 ] ; then exit 1 ; fi
  433. cd build
  434. echo -en 'travis_fold:end:script.build.codecov\\r'
  435. echo -en "\r\n== Building coveralls for ${TRAVIS_REPO_SLUG} ==" && echo -en 'travis_fold:start:script.build.coveralls\\r'
  436. 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
  437. echo -en 'travis_fold:end:script.build.coveralls\\r'
  438. fi
  439. cd .. && rm build -rf
  440. fi