]> source.dussan.org Git - sonarqube.git/commitdiff
Add PR analysis to travis-ci
authorThomas Vérin <thomas.verin@sonarsource.com>
Fri, 19 Jun 2015 14:43:38 +0000 (16:43 +0200)
committerThomas Vérin <thomas.verin@sonarsource.com>
Fri, 19 Jun 2015 14:43:38 +0000 (16:43 +0200)
.travis.yml
travis.sh

index bd038ef5ed462a94c0ef52e1f654ee1c938b1be1..c87e65797c9a4d2934d5d483d600d4bb05d08546 100644 (file)
@@ -6,9 +6,10 @@ jdk:
   - oraclejdk8
 
 env:
-  - DATABASE=H2
-  - DATABASE=POSTGRES
-  - DATABASE=MYSQL
+  - JOB=H2
+  - JOB=POSTGRES
+  - JOB=MYSQL
+  - JOB=PRANALYSIS
 
 script:
   - ./travis.sh
index 741e450c4958be0de2800e6ccf6f02e37b1406b0..114fb5151e053f60177d0f8150a3aa8efa48d0af 100755 (executable)
--- a/travis.sh
+++ b/travis.sh
@@ -6,7 +6,7 @@ function installTravisTools {
   curl -sSL https://raw.githubusercontent.com/sonarsource/travis-utils/v2.1/install.sh | bash
 }
 
-case "$DATABASE" in
+case "$JOB" in
 
 H2)
   mvn verify -B -e -V
@@ -31,8 +31,23 @@ MYSQL)
   travis_runDatabaseCI "mysql" "jdbc:mysql://localhost/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance" "sonar" "sonar"
   ;;
 
+PRANALYSIS)
+  if [ -n "$SONAR_GITHUB_OAUTH" ] && [ "${TRAVIS_PULL_REQUEST}" != "false" ] 
+  then
+    echo "Start pullrequest analysis"
+    mvn sonar:sonar \
+     -Dsonar.analysis.mode=preview \
+     -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
+     -Dsonar.github.repository=$SONAR_GITHUB_REPOSITORY \
+     -Dsonar.forceUpdate=true \
+     -Dsonar.github.login=$SONAR_GITHUB_LOGIN \
+     -Dsonar.github.oauth=$SONAR_GITHUB_OAUTH \
+     -Dsonar.host.url=$SONAR_HOST_URL 
+  fi 
+  ;;
+
 *)
-  echo "Invalid DATABASE choice [$DATABASE]"
+  echo "Invalid JOB choice [$JOB]"
   exit 1
 
 esac