diff options
Diffstat (limited to 'travis.sh')
-rwxr-xr-x | travis.sh | 71 |
1 files changed, 39 insertions, 32 deletions
@@ -8,41 +8,48 @@ function installTravisTools { source ~/.local/bin/install } -case "$TESTS" in +if [ -n "${PR_ANALYSIS:-}" ] && [ "${PR_ANALYSIS}" == true ] +then + if [ "$TRAVIS_PULL_REQUEST" != "false" ] + then + # For security reasons environment variables are not available on the pull requests + # coming from outside repositories + # http://docs.travis-ci.com/user/pull-requests/#Security-Restrictions-when-testing-Pull-Requests + if [ -n "$SONAR_GITHUB_OAUTH" ]; then + + # Switch to java 8 as the Dory HTTPS certificate is not supported by Java 7 + export JAVA_HOME=/usr/lib/jvm/java-8-oracle + export PATH=$JAVA_HOME/bin:$PATH + + # PR analysis + mvn verify sonar:sonar -B -e -V \ + -Dsonar.analysis.mode=issues \ + -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \ + -Dsonar.github.repository=$TRAVIS_REPO_SLUG \ + -Dsonar.github.login=$SONAR_GITHUB_LOGIN \ + -Dsonar.github.oauth=$SONAR_GITHUB_OAUTH \ + -Dsonar.host.url=$SONAR_HOST_URL \ + -Dsonar.login=$SONAR_LOGIN \ + -Dsonar.password=$SONAR_PASSWD + fi + fi +else + # Regular CI (use install for ITs) + mvn install -B -e -V +fi + +if [ -n "${RUN_ITS:-}" ] && [ "${RUN_ITS}" == true ] +then -CI) installTravisTools + build_snapshot "SonarSource/orchestrator" - mvn verify -B -e -V - ;; - -IT-DEV) - installTravisTools - - build_snapshot "SonarSource/sonarqube" - - mvn install -Dsource.skip=true -Denforcer.skip=true -Danimal.sniffer.skip=true -Dmaven.test.skip=true - - cd it - mvn -DsonarRunner.version="2.5-SNAPSHOT" -Dsonar.runtimeVersion="DEV" -Dmaven.test.redirectTestOutputToFile=false install - ;; - -IT-DEV-SQ51) - installTravisTools - - mvn install -Dsource.skip=true -Denforcer.skip=true -Danimal.sniffer.skip=true -Dmaven.test.skip=true - - cd it - mvn -DsonarRunner.version="2.5-SNAPSHOT" -Dsonar.runtimeVersion="5.1.2" -Dmaven.test.redirectTestOutputToFile=false install - ;; - -IT-DEV-LTS) - installTravisTools - - mvn install -Dsource.skip=true -Denforcer.skip=true -Danimal.sniffer.skip=true -Dmaven.test.skip=true + if [ "${SQ_VERSION}" == "DEV" ] + then + build_snapshot "SonarSource/sonarqube" + fi cd it - mvn -DsonarRunner.version="2.5-SNAPSHOT" -Dsonar.runtimeVersion="4.5.5" -Dmaven.test.redirectTestOutputToFile=false install - ;; + mvn -DsonarRunner.version="2.5-SNAPSHOT" -Dsonar.runtimeVersion=$SQ_VERSION -Dmaven.test.redirectTestOutputToFile=false install -esac +fi |