Newer
Older
dub_jkp / travis-ci.sh
  1. #!/bin/bash
  2.  
  3. set -v -e -o pipefail
  4.  
  5. source ~/dlang/*/activate # activate host compiler
  6.  
  7. if [ -z "$FRONTEND" -o "$FRONTEND" \> 2.072.z ]; then
  8. vibe_ver=$(jq -r '.versions | .["vibe-d"]' < dub.selections.json)
  9. dub fetch vibe-d --version=$vibe_ver # get optional dependency
  10. dub test --compiler=${DC} -c library-nonet
  11. fi
  12.  
  13. function clean() {
  14. # Hard reset of the DUB local folder is necessary as some tests
  15. # currently don't properly clean themselves
  16. rm -rf ~/.dub
  17. git clean -dxf -- test
  18. }
  19.  
  20. if [ "$COVERAGE" = true ]; then
  21. # library-nonet fails to build with coverage (Issue 13742)
  22. dub test --compiler=${DC} -b unittest-cov
  23. ./build.sh -cov
  24.  
  25. # run tests with different compilers
  26. DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh
  27. deactivate
  28. clean
  29.  
  30. export FRONTEND=2.077
  31. source $(~/dlang/install.sh ldc-1.7.0 --activate)
  32. DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh
  33. deactivate
  34. clean
  35.  
  36. export FRONTEND=2.068
  37. source $(~/dlang/install.sh gdc-4.8.5 --activate)
  38. DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh
  39. deactivate
  40. else
  41. ./build.sh
  42. DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh
  43. fi
  44.  
  45. if [ "$COVERAGE" = true ]; then
  46. wget https://codecov.io/bash -O codecov.sh
  47. bash codecov.sh
  48. fi
  49.  
  50. # check for trailing whitespace (needs to be done only once per build)
  51. if [ "$COVERAGE" = true ]; then
  52. find . -type f -name '*.d' -exec grep -Hn "[[:blank:]]$" {} \;
  53. fi
  54.  
  55. # check that the man page generation still works (only once)
  56. if [ "$COVERAGE" = true ]; then
  57. source $(~/dlang/install.sh dmd --activate)
  58. dub --single -v scripts/man/gen_man.d
  59. fi