You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

travis.sh 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. ./.travis/setup_ramdisk.sh
  4. #
  5. # Configure Maven settings and install some script utilities
  6. #
  7. configureTravis() {
  8. mkdir -p ~/.local
  9. curl -sSL https://github.com/SonarSource/travis-utils/tarball/v55 | tar zx --strip-components 1 -C ~/.local
  10. source ~/.local/bin/install
  11. }
  12. configureTravis
  13. #
  14. # Travis fails on timeout when build does not print logs
  15. # during 10 minutes. This aims to bypass this
  16. # behavior when building the slow sonar-server sub-project.
  17. #
  18. keep_alive() {
  19. while true; do
  20. echo -en "\a"
  21. sleep 60
  22. done
  23. }
  24. keep_alive &
  25. # When a pull request is open on the branch, then the job related
  26. # to the branch does not need to be executed and should be canceled.
  27. # It does not book slaves for nothing.
  28. # @TravisCI please provide the feature natively, like at AppVeyor or CircleCI ;-)
  29. cancel_branch_build_with_pr || if [[ $? -eq 1 ]]; then exit 0; fi
  30. case "$TARGET" in
  31. BUILD)
  32. git fetch --unshallow
  33. ./gradlew build --no-daemon --console plain
  34. # the '-' at the end is needed when using set -u (the 'nounset' flag)
  35. # see https://stackoverflow.com/a/9824943/641955
  36. if [[ -n "${SONAR_TOKEN-}" ]]; then
  37. ./gradlew jacocoTestReport sonarqube --no-daemon --console plain \
  38. -Dsonar.projectKey=org.sonarsource.sonarqube:sonarqube \
  39. -Dsonar.organization=sonarsource \
  40. -Dsonar.host.url=https://sonarcloud.io \
  41. -Dsonar.login="$SONAR_TOKEN"
  42. # Wait for 5mins, hopefully the report will be processed.
  43. sleep 5m
  44. ./.travis/run_iris.sh
  45. fi
  46. ;;
  47. WEB_TESTS)
  48. ./gradlew :server:sonar-web:yarn :server:sonar-web:yarn_validate --no-daemon --console plain
  49. ;;
  50. *)
  51. echo "Unexpected TARGET value: $TARGET"
  52. exit 1
  53. ;;
  54. esac