travis_linux_script.sh 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  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 and certificate 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. -DUA_BUILD_SELFSIGNED_CERTIFICATE=ON ..
  188. make doc
  189. make doc_pdf
  190. make selfsigned
  191. cp -r doc ../../
  192. cp -r doc_latex ../../
  193. cp ./examples/server_cert.der ../../
  194. cd .. && rm build -rf
  195. echo -en 'travis_fold:end:script.build.doc\\r'
  196. # cross compilation only with gcc
  197. if ! [ -z ${MINGW+x} ]; then
  198. echo -e "\r\n== Cross compile release build for MinGW 32 bit ==" && echo -en 'travis_fold:start:script.build.cross_mingw32\\r'
  199. mkdir -p build && cd build
  200. cmake \
  201. -DBUILD_SHARED_LIBS=ON \
  202. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  203. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-win32 \
  204. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw32.cmake \
  205. -DUA_BUILD_EXAMPLES=ON \
  206. -DUA_ENABLE_AMALGAMATION=OFF ..
  207. make -j
  208. if [ $? -ne 0 ] ; then exit 1 ; fi
  209. make install
  210. if [ $? -ne 0 ] ; then exit 1 ; fi
  211. cd ..
  212. zip -r open62541-win32.zip ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-win32/*
  213. rm build -rf
  214. echo -en 'travis_fold:end:script.build.cross_mingw32\\r'
  215. echo -e "\r\n== Cross compile release build for MinGW 64 bit ==" && echo -en 'travis_fold:start:script.build.cross_mingw64\\r'
  216. mkdir -p build && cd build
  217. cmake \
  218. -DBUILD_SHARED_LIBS=ON \
  219. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  220. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-win64 \
  221. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-mingw64.cmake \
  222. -DUA_BUILD_EXAMPLES=ON \
  223. -DUA_ENABLE_AMALGAMATION=OFF ..
  224. make -j
  225. if [ $? -ne 0 ] ; then exit 1 ; fi
  226. make install
  227. if [ $? -ne 0 ] ; then exit 1 ; fi
  228. cd ..
  229. zip -r open62541-win64.zip ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-win64/*
  230. rm build -rf
  231. echo -en 'travis_fold:end:script.build.cross_mingw64\\r'
  232. echo -e "\r\n== Cross compile release build for 32-bit linux ==" && echo -en 'travis_fold:start:script.build.cross_linux\\r'
  233. mkdir -p build && cd build
  234. cmake \
  235. -DBUILD_SHARED_LIBS=ON \
  236. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  237. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux32 \
  238. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-gcc-m32.cmake \
  239. -DUA_BUILD_EXAMPLES=ON \
  240. -DUA_ENABLE_AMALGAMATION=OFF ..
  241. make -j
  242. if [ $? -ne 0 ] ; then exit 1 ; fi
  243. make install
  244. if [ $? -ne 0 ] ; then exit 1 ; fi
  245. cd ..
  246. tar -pczf open62541-linux32.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-linux32/*
  247. rm build -rf
  248. echo -en 'travis_fold:end:script.build.cross_linux\\r'
  249. echo -e "\r\n== Cross compile release build for RaspberryPi ==" && echo -en 'travis_fold:start:script.build.cross_raspi\\r'
  250. mkdir -p build && cd build
  251. git clone https://github.com/raspberrypi/tools
  252. export PATH=$PATH:${TRAVIS_BUILD_DIR}/build/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/
  253. cmake \
  254. -DBUILD_SHARED_LIBS=ON \
  255. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  256. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-raspberrypi \
  257. -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/Toolchain-rpi64.cmake \
  258. -DUA_BUILD_EXAMPLES=ON \
  259. -DUA_ENABLE_AMALGAMATION=OFF ..
  260. make -j
  261. if [ $? -ne 0 ] ; then exit 1 ; fi
  262. make install
  263. if [ $? -ne 0 ] ; then exit 1 ; fi
  264. cd ..
  265. tar -pczf open62541-raspberrypi.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-raspberrypi/*
  266. rm build -rf
  267. echo -en 'travis_fold:end:script.build.cross_raspi\\r'
  268. fi
  269. echo -e "\r\n== Compile release build for 64-bit linux ==" && echo -en 'travis_fold:start:script.build.linux_64\\r'
  270. mkdir -p build && cd build
  271. cmake \
  272. -DBUILD_SHARED_LIBS=ON \
  273. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  274. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux64 \
  275. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  276. -DUA_BUILD_EXAMPLES=ON \
  277. -DUA_ENABLE_AMALGAMATION=OFF ..
  278. make -j
  279. if [ $? -ne 0 ] ; then exit 1 ; fi
  280. make install
  281. if [ $? -ne 0 ] ; then exit 1 ; fi
  282. cd ..
  283. tar -pczf open62541-linux64.tar.gz ../doc_latex/open62541.pdf LICENSE AUTHORS README.md open62541-linux64/*
  284. rm build -rf
  285. echo -en 'travis_fold:end:script.build.linux_64\\r'
  286. echo -e "\r\n== Compile with amalgamation ==" && echo -en 'travis_fold:start:script.build.amalgamate\\r'
  287. mkdir -p build && cd build
  288. cmake \
  289. -DBUILD_SHARED_LIBS=ON \
  290. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  291. -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/open62541-linux64 \
  292. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  293. -DUA_BUILD_EXAMPLES=OFF \
  294. -DUA_ENABLE_AMALGAMATION=ON \
  295. -DUA_ENABLE_HISTORIZING=ON ..
  296. make -j
  297. cp open62541.h ../.. # copy single file-release
  298. cp open62541.c ../.. # copy single file-release
  299. gcc -std=c99 -c open62541.c
  300. g++ ../examples/server.cpp -I./ open62541.o -lrt -o cpp-server
  301. if [ $? -ne 0 ] ; then exit 1 ; fi
  302. cd .. && rm build -rf
  303. echo -en 'travis_fold:end:script.build.amalgamate\\r'
  304. echo "Compile as shared lib version" && echo -en 'travis_fold:start:script.build.shared_libs\\r'
  305. mkdir -p build && cd build
  306. cmake \
  307. -DBUILD_SHARED_LIBS=ON \
  308. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  309. -DUA_BUILD_EXAMPLES=ON \
  310. -DUA_ENABLE_AMALGAMATION=OFF ..
  311. make -j
  312. if [ $? -ne 0 ] ; then exit 1 ; fi
  313. cd .. && rm build -rf
  314. echo -en 'travis_fold:end:script.build.shared_libs\\r'
  315. if [ "$CC" != "tcc" ]; then
  316. echo -e "\r\n==Compile multithreaded version==" && echo -en 'travis_fold:start:script.build.multithread\\r'
  317. mkdir -p build && cd build
  318. cmake \
  319. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  320. -DUA_BUILD_EXAMPLES=ON \
  321. -DUA_ENABLE_MULTITHREADING=ON ..
  322. make -j
  323. if [ $? -ne 0 ] ; then exit 1 ; fi
  324. cd .. && rm build -rf
  325. echo -en 'travis_fold:end:script.build.multithread\\r'
  326. fi
  327. echo -e "\r\n== Compile with encryption ==" && echo -en 'travis_fold:start:script.build.encryption\\r'
  328. mkdir -p build && cd build
  329. cmake \
  330. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  331. -DUA_BUILD_EXAMPLES=ON \
  332. -DUA_ENABLE_ENCRYPTION=ON ..
  333. make -j
  334. if [ $? -ne 0 ] ; then exit 1 ; fi
  335. cd .. && rm build -rf
  336. echo -en 'travis_fold:end:script.build.encryption\\r'
  337. echo -e "\r\n== Compile without discovery version ==" && echo -en 'travis_fold:start:script.build.discovery\\r'
  338. mkdir -p build && cd build
  339. cmake \
  340. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  341. -DUA_BUILD_EXAMPLES=ON \
  342. -DUA_ENABLE_DISCOVERY=OFF \
  343. -DUA_ENABLE_DISCOVERY_MULTICAST=OFF ..
  344. make -j
  345. if [ $? -ne 0 ] ; then exit 1 ; fi
  346. cd .. && rm build -rf
  347. echo -en 'travis_fold:end:script.build.discovery\\r'
  348. if [ "$CC" != "tcc" ]; then
  349. echo -e "\r\n== Compile multithreaded version with discovery ==" && echo -en 'travis_fold:start:script.build.multithread_discovery\\r'
  350. mkdir -p build && cd build
  351. cmake \
  352. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  353. -DUA_BUILD_EXAMPLES=ON \
  354. -DUA_ENABLE_DISCOVERY=ON \
  355. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  356. -DUA_ENABLE_MULTITHREADING=ON ..
  357. make -j
  358. if [ $? -ne 0 ] ; then exit 1 ; fi
  359. cd .. && rm build -rf
  360. echo -en 'travis_fold:end:script.build.multithread_discovery\\r'
  361. fi
  362. echo -e "\r\n== Compile JSON encoding ==" && echo -en 'travis_fold:start:script.build.json\\r'
  363. mkdir -p build && cd build
  364. cmake \
  365. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  366. -DUA_ENABLE_JSON_ENCODING=ON ..
  367. make -j
  368. if [ $? -ne 0 ] ; then exit 1 ; fi
  369. cd .. && rm build -rf
  370. echo -en 'travis_fold:end:script.build.json\\r'
  371. echo -e "\r\n== Unit tests (full NS0) ==" && echo -en 'travis_fold:start:script.build.unit_test_ns0_full\\r'
  372. mkdir -p build && cd build
  373. # Valgrind cannot handle the full NS0 because the generated file is too big. Thus run NS0 full without valgrind
  374. cmake \
  375. -DCMAKE_BUILD_TYPE=Debug \
  376. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  377. -DUA_BUILD_EXAMPLES=ON \
  378. -DUA_BUILD_UNIT_TESTS=ON \
  379. -DUA_ENABLE_COVERAGE=OFF \
  380. -DUA_ENABLE_DA=ON \
  381. -DUA_ENABLE_DISCOVERY=ON \
  382. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  383. -DUA_ENABLE_ENCRYPTION=ON \
  384. -DUA_ENABLE_JSON_ENCODING=ON \
  385. -DUA_ENABLE_PUBSUB=ON \
  386. -DUA_ENABLE_PUBSUB_DELTAFRAMES=ON \
  387. -DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON \
  388. -DUA_ENABLE_SUBSCRIPTIONS=ON \
  389. -DUA_ENABLE_SUBSCRIPTIONS_EVENTS=ON \
  390. -DUA_ENABLE_UNIT_TESTS_MEMCHECK=OFF \
  391. -DUA_NAMESPACE_ZERO=FULL ..
  392. make -j && make test ARGS="-V"
  393. if [ $? -ne 0 ] ; then exit 1 ; fi
  394. cd .. && rm build -rf
  395. echo -en 'travis_fold:end:script.build.unit_test_ns0_full\\r'
  396. if ! [ -z ${DEBIAN+x} ]; then
  397. echo -e "\r\n== Building the Debian package ==" && echo -en 'travis_fold:start:script.build.debian\\r'
  398. dpkg-buildpackage -b
  399. if [ $? -ne 0 ] ; then exit 1 ; fi
  400. cp ../open62541*.deb .
  401. # Copy for github release script
  402. cp ../open62541*.deb ../..
  403. echo -en 'travis_fold:end:script.build.debian\\r'
  404. fi
  405. if [ "$CC" != "tcc" ]; then
  406. echo -e "\r\n== Unit tests (minimal NS0) ==" && echo -en 'travis_fold:start:script.build.unit_test_ns0_minimal\\r'
  407. mkdir -p build && cd build
  408. cmake \
  409. -DCMAKE_BUILD_TYPE=Debug \
  410. -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$PYTHON \
  411. -DUA_BUILD_EXAMPLES=ON \
  412. -DUA_BUILD_UNIT_TESTS=ON \
  413. -DUA_ENABLE_COVERAGE=ON \
  414. -DUA_ENABLE_DA=ON \
  415. -DUA_ENABLE_DISCOVERY=ON \
  416. -DUA_ENABLE_DISCOVERY_MULTICAST=ON \
  417. -DUA_ENABLE_ENCRYPTION=ON \
  418. -DUA_ENABLE_JSON_ENCODING=ON \
  419. -DUA_ENABLE_PUBSUB=ON \
  420. -DUA_ENABLE_PUBSUB_DELTAFRAMES=ON \
  421. -DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON \
  422. -DUA_ENABLE_UNIT_TESTS_MEMCHECK=ON ..
  423. make -j && make test ARGS="-V"
  424. if [ $? -ne 0 ] ; then exit 1 ; fi
  425. echo -en 'travis_fold:end:script.build.unit_test_ns0_minimal\\r'
  426. # only run coveralls on main repo and when MINGW=true
  427. # We only want to build coveralls once, so we just take the travis run where MINGW=true which is only enabled once
  428. echo -e "\r\n== -> Current repo: ${TRAVIS_REPO_SLUG} =="
  429. if [ $MINGW = "true" ] && [ "${TRAVIS_REPO_SLUG}" = "open62541/open62541" ]; then
  430. echo -en "\r\n== Building codecov.io for ${TRAVIS_REPO_SLUG} ==" && echo -en 'travis_fold:start:script.build.codecov\\r'
  431. cd ..
  432. /bin/bash -c "bash <(curl -s https://codecov.io/bash)"
  433. if [ $? -ne 0 ] ; then exit 1 ; fi
  434. cd build
  435. echo -en 'travis_fold:end:script.build.codecov\\r'
  436. echo -en "\r\n== Building coveralls for ${TRAVIS_REPO_SLUG} ==" && echo -en 'travis_fold:start:script.build.coveralls\\r'
  437. 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
  438. echo -en 'travis_fold:end:script.build.coveralls\\r'
  439. fi
  440. cd .. && rm build -rf
  441. fi