ci.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. set -e
  3. build_configuration() {
  4. echo "Building configuration $1"
  5. mkdir -p build
  6. cd build
  7. cmake $1 ..
  8. make
  9. mkdir -p root
  10. make DESTDIR=root install
  11. cd ..
  12. }
  13. cleanup() {
  14. cd build
  15. make DESTDIR=root uninstall
  16. make clean
  17. rm -f sampleclient
  18. rm -f sampleserver
  19. cd ..
  20. rm -rf build
  21. }
  22. rm -rf reports
  23. mkdir -p reports
  24. build_configuration "-DCMAKE_BUILD_TYPE=Debug -DHTTP_SERVER=YES -DHTTP_CLIENT=YES -DCOMPILE_STUBGEN=YES -DCOMPILE_EXAMPLES=YES -DCOMPILE_TESTS=YES -DUNIX_DOMAIN_SOCKET_SERVER=YES -DUNIX_DOMAIN_SOCKET_CLIENT=YES"
  25. echo "Compiling examples"
  26. cd build
  27. g++ ../src/examples/simpleclient.cpp -Iroot/usr/local/include -Lroot/usr/local/lib -ljsonrpccpp-client -ljsoncpp -ljsonrpccpp-common -lcurl -o sampleclient
  28. g++ ../src/examples/simpleserver.cpp -Iroot/usr/local/include -Lroot/usr/local/lib -ljsonrpccpp-server -ljsoncpp -ljsonrpccpp-common -lmicrohttpd -o sampleserver
  29. test -f sampleclient
  30. test -f sampleserver
  31. echo "Generating valgrind report"
  32. valgrind --leak-check=full --xml=yes --xml-file=../reports/valgrind.xml ./bin/unit_testsuite --reporter=junit --out=../reports/tests.xml
  33. echo "Generating coverage report"
  34. gcovr -e "build" -e "src/test" -x -r .. > ../reports/coverage.xml
  35. gcovr -e "build" -e "src/test" -r .. --html --html-details -o ../reports/coverage.html
  36. echo "Generating cppcheck report"
  37. cppcheck -I ../src --enable=all --xml ../src --xml-version=2 2> ../reports/cppcheck.xml
  38. cd ..
  39. echo "Cleanup that mess"
  40. cleanup
  41. build_configuration "-DCMAKE_BUILD_TYPE=Debug -DHTTP_SERVER=NO -DHTTP_CLIENT=NO -DCOMPILE_STUBGEN=YES -DCOMPILE_EXAMPLES=YES -DCOMPILE_TESTS=YES -DUNIX_DOMAIN_SOCKET_SERVER=NO -DUNIX_DOMAIN_SOCKET_CLIENT=NO"
  42. cleanup
  43. echo "Integration successful"