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.074.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. if [ "$FRONTEND" \> 2.087.z ]; then
  14. DFLAGS='-preview=dip1000 -w -g -debug' DMD="$(command -v $DMD)" ./build.sh
  15. fi
  16.  
  17. function clean() {
  18. # Hard reset of the DUB local folder is necessary as some tests
  19. # currently don't properly clean themselves
  20. rm -rf ~/.dub
  21. git clean -dxf -- test
  22. }
  23.  
  24. if [ "$COVERAGE" = true ]; then
  25. # library-nonet fails to build with coverage (Issue 13742)
  26. dub test --compiler=${DC} -b unittest-cov
  27. ./build.sh -cov
  28.  
  29. # run tests with different compilers
  30. DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh
  31. deactivate
  32. clean
  33.  
  34. export FRONTEND=2.077
  35. source $(~/dlang/install.sh ldc-1.7.0 --activate)
  36. DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh
  37. deactivate
  38. clean
  39.  
  40. export FRONTEND=2.068
  41. source $(~/dlang/install.sh gdc-4.8.5 --activate)
  42. DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh
  43. deactivate
  44. else
  45. ./build.sh
  46. DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh
  47. fi
  48.  
  49. if [ "$COVERAGE" = true ]; then
  50. wget https://codecov.io/bash -O codecov.sh
  51. bash codecov.sh
  52. fi
  53.  
  54. # check for trailing whitespace (needs to be done only once per build)
  55. if [ "$COVERAGE" = true ]; then
  56. find . -type f -name '*.d' -exec grep -Hn "[[:blank:]]$" {} \;
  57. fi
  58.  
  59. # check that the man page generation still works (only once)
  60. if [ "$COVERAGE" = true ]; then
  61. source $(~/dlang/install.sh dmd --activate)
  62. dub --single -v scripts/man/gen_man.d
  63. fi