travis_linux_script.sh 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/bin/bash
  2. set -ev
  3. echo "Checking the applicability of patches"
  4. # ./tools/.checkPorts.sh
  5. echo "Documentation and certificate build"
  6. mkdir -p build
  7. cd build
  8. cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCUMENTATION=ON -DGENERATE_SELFSIGNED=ON ..
  9. make doc
  10. make selfsigned
  11. cp -r doc ..
  12. cp server_cert.der ..
  13. echo "Testing builds"
  14. cd .. && rm build -rf && mkdir -p build && cd build
  15. echo "Cross compile release build for MinGW 32 bit"
  16. cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw32.cmake -DENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
  17. make
  18. cp ../README.md .
  19. cp ../LICENSE .
  20. cp ../AUTHORS .
  21. cp -r ../doc .
  22. cp ../server_cert.der .
  23. zip -r open62541-win32.zip doc server_cert.der LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
  24. cp open62541-win32.zip ..
  25. cd .. && rm build -rf && mkdir -p build && cd build
  26. echo "Cross compile release build for MinGW 64 bit"
  27. cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake -DENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
  28. make
  29. cp ../README.md .
  30. cp ../LICENSE .
  31. cp ../AUTHORS .
  32. cp -r ../doc .
  33. cp ../server_cert.der .
  34. zip -r open62541-win64.zip doc server_cert.der LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
  35. cp open62541-win64.zip ..
  36. cd .. && rm build -rf && mkdir -p build && cd build
  37. echo "Cross compile release build for 32-bit linux"
  38. cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-m32.cmake -DENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
  39. make
  40. tar -pczf open62541-linux32.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
  41. cp open62541-linux32.tar.gz ..
  42. cd .. && rm build -rf && mkdir -p build && cd build
  43. echo "Compile release build for 64-bit linux"
  44. cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_AMALGAMATION=ON -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
  45. make
  46. tar -pczf open62541-linux64.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
  47. cp open62541-linux64.tar.gz ..
  48. cp open62541.h .. #copy single file-release
  49. cp open62541.c .. #copy single file-release
  50. echo "Upgrade to gcc 4.8"
  51. sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  52. sudo apt-get update -qq
  53. sudo apt-get install -qq gcc-4.8 g++-4.8 valgrind
  54. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
  55. sudo update-alternatives --config gcc
  56. echo "Building the C++ example"
  57. gcc -std=c99 -c open62541.c
  58. g++-4.8 ../examples/server.cpp -I./ open62541.o -o cpp-server
  59. cd .. && rm build -rf && mkdir -p build && cd build
  60. echo "Compile multithreaded version"
  61. cmake -DENABLE_MULTITHREADING=ON -DBUILD_EXAMPLESERVER=ON ..
  62. make
  63. # push updated doc
  64. BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
  65. if [[ "$BRANCH" = "master" ]]; then
  66. cd .. && rm build -rf && mkdir -p build && cd build
  67. cd build
  68. rm -rf *
  69. cmake -DBUILD_DOCUMENTATION=ON ..
  70. make doc
  71. git clone --depth=5 -b gh-pages https://$GITAUTH@github.com/acplt/open62541-www
  72. cd open62541-www
  73. git rm -r -f ./doc/current/*
  74. cp -r ../doc/* ./doc/current/
  75. git add -A ./doc/current
  76. git config --global user.email "open62541-travis-ci@users.noreply.github.com"
  77. git config --global user.name "Open62541 travis-ci"
  78. git config --global push.default simple
  79. git commit -am "gh-pages updated by travis-ci"
  80. git push https://$GITAUTH@github.com/open62541/open62541-www
  81. cd ..
  82. rm -rf open62541-www
  83. fi
  84. cd .. && rm build -rf && mkdir -p build && cd build
  85. echo "Debug build and unit tests (64 bit)"
  86. cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_DEMO_NODESET=ON -DBUILD_UNIT_TESTS=ON -DBUILD_EXAMPLESERVER=ON -DENABLE_COVERAGE=ON ..
  87. make && make test ARGS="-V"
  88. echo "Run valgrind to see if the server leaks memory (just starting up and closing..)"
  89. if [[ ! ( ${TRAVIS_OS_NAME} == "linux" && ${CC} == "clang") ]]; then
  90. (valgrind --error-exitcode=3 ./server & export pid=$!; sleep 2; kill -INT $pid; wait $pid);
  91. (coveralls --gcov /usr/bin/gcov-4.8 -E '.*\.h' -E '.*CMakeCXXCompilerId\.cpp' -E '.*CMakeCCompilerId\.c' -r ../ ; exit 0);
  92. fi
  93. cd ..