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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. set -euo pipefail
  3. function installTravisTools {
  4. mkdir ~/.local
  5. curl -sSL https://github.com/SonarSource/travis-utils/tarball/v16 | tar zx --strip-components 1 -C ~/.local
  6. source ~/.local/bin/install
  7. }
  8. if [ -n "${PR_ANALYSIS:-}" ] && [ "${PR_ANALYSIS}" == true ]
  9. then
  10. if [ "$TRAVIS_PULL_REQUEST" != "false" ]
  11. then
  12. # For security reasons environment variables are not available on the pull requests
  13. # coming from outside repositories
  14. # http://docs.travis-ci.com/user/pull-requests/#Security-Restrictions-when-testing-Pull-Requests
  15. if [ -n "$SONAR_GITHUB_OAUTH" ]; then
  16. # Switch to java 8 as the Dory HTTPS certificate is not supported by Java 7
  17. export JAVA_HOME=/usr/lib/jvm/java-8-oracle
  18. export PATH=$JAVA_HOME/bin:$PATH
  19. # PR analysis
  20. mvn verify sonar:sonar -B -e -V \
  21. -Dsonar.analysis.mode=issues \
  22. -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
  23. -Dsonar.github.repository=$TRAVIS_REPO_SLUG \
  24. -Dsonar.github.login=$SONAR_GITHUB_LOGIN \
  25. -Dsonar.github.oauth=$SONAR_GITHUB_OAUTH \
  26. -Dsonar.host.url=$SONAR_HOST_URL \
  27. -Dsonar.login=$SONAR_LOGIN \
  28. -Dsonar.password=$SONAR_PASSWD
  29. fi
  30. fi
  31. else
  32. # Regular CI (use install for ITs)
  33. mvn install -B -e -V
  34. fi
  35. if [ -n "${RUN_ITS:-}" ] && [ "${RUN_ITS}" == true ]
  36. then
  37. installTravisTools
  38. build_snapshot "SonarSource/orchestrator"
  39. if [ "${SQ_VERSION}" == "DEV" ]
  40. then
  41. build_snapshot "SonarSource/sonarqube"
  42. fi
  43. cd it
  44. mvn -DsonarRunner.version="2.5-SNAPSHOT" -Dsonar.runtimeVersion=$SQ_VERSION -Dmaven.test.redirectTestOutputToFile=false install
  45. fi