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.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. git fetch --unshallow
  31. ./gradlew build --no-daemon --console plain
  32. # the '-' at the end is needed when using set -u (the 'nounset' flag)
  33. # see https://stackoverflow.com/a/9824943/641955
  34. if [[ -n "${SONAR_TOKEN-}" ]]; then
  35. if [[ "${TRAVIS_BRANCH}" == "master" ]]; then
  36. ./gradlew jacocoTestReport :server:sonar-web:yarn_validate-ci sonarqube --info --no-daemon --console plain \
  37. -Dsonar.projectKey=org.sonarsource.sonarqube:sonarqube \
  38. -Dsonar.organization=sonarsource \
  39. -Dsonar.host.url=https://sonarcloud.io \
  40. -Dsonar.login="$SONAR_TOKEN"
  41. else
  42. ./gradlew jacocoTestReport :server:sonar-web:yarn_validate-ci sonarqube --info --no-daemon --console plain \
  43. -Dsonar.projectKey=org.sonarsource.sonarqube:sonarqube \
  44. -Dsonar.organization=sonarsource \
  45. -Dsonar.host.url=https://sonarcloud.io \
  46. -Dsonar.login="$SONAR_TOKEN" \
  47. -Dsonar.branch.name="$TRAVIS_BRANCH"
  48. fi
  49. # Wait for 5mins, hopefully the report will be processed.
  50. sleep 5m
  51. ./.travis/run_iris.sh
  52. fi