aboutsummaryrefslogtreecommitdiffstats
path: root/travis.sh
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-08-17 14:30:38 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-08-17 14:31:13 +0200
commit51a85838f298e37b10ffa330588e4626a6466294 (patch)
tree236f4bdd62c0892f8d7599a7afa41d001acece58 /travis.sh
parentfae038c5e6c24dc805eb635b6efcd5bdca7ba615 (diff)
downloadsonarqube-51a85838f298e37b10ffa330588e4626a6466294.tar.gz
sonarqube-51a85838f298e37b10ffa330588e4626a6466294.zip
Revert "DO NOT MERGE"
This reverts commit fae038c5e6c24dc805eb635b6efcd5bdca7ba615. ... because return from holidays is hard
Diffstat (limited to 'travis.sh')
-rwxr-xr-xtravis.sh53
1 files changed, 51 insertions, 2 deletions
diff --git a/travis.sh b/travis.sh
index b62a05ecfa8..c1fb2fbf84b 100755
--- a/travis.sh
+++ b/travis.sh
@@ -128,10 +128,59 @@ BUILD)
export MAVEN_OPTS="-Xmx1G -Xms128m"
MAVEN_ARGS="-T 1C -Dmaven.test.redirectTestOutputToFile=false -Dsurefire.useFile=false -B -e -V -DbuildVersion=$BUILD_VERSION -Dtests.es.logger.level=WARN"
- mvn deploy \
+ if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
+ echo 'Build and analyze master'
+
+ # Fetch all commit history so that SonarQube has exact blame information
+ # for issue auto-assignment
+ # This command can fail with "fatal: --unshallow on a complete repository does not make sense"
+ # if there are not enough commits in the Git repository (even if Travis executed git clone --depth 50).
+ # For this reason errors are ignored with "|| true"
+ git fetch --unshallow || true
+
+ mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy \
$MAVEN_ARGS \
- -Pdeploy-sonarsource -DskipTests
+ -Pdeploy-sonarsource,release
+ if [[ "$TRAVIS_BUILD_NUMBER" == *0 ]]; then
+ mvn sonar:sonar \
+ -Dsonar.host.url=$SONAR_HOST_URL \
+ -Dsonar.login=$SONAR_TOKEN \
+ -Dsonar.projectVersion=$INITIAL_VERSION
+ else
+ mvn sonar:sonar \
+ -Dsonar.incremental=true \
+ -Dsonar.host.url=$SONAR_HOST_URL \
+ -Dsonar.login=$SONAR_TOKEN \
+ -Dsonar.projectVersion=$INITIAL_VERSION
+ fi
+
+ elif [[ "$TRAVIS_BRANCH" == "branch-"* ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
+ echo 'Build release branch'
+
+ mvn deploy $MAVEN_ARGS -Pdeploy-sonarsource,release
+
+ elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN:-}" ]; then
+ echo 'Build and analyze internal pull request'
+
+ mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy \
+ $MAVEN_ARGS \
+ -Dsource.skip=true \
+ -Pdeploy-sonarsource
+ mvn sonar:sonar \
+ -Dsonar.analysis.mode=preview \
+ -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
+ -Dsonar.github.repository=$TRAVIS_REPO_SLUG \
+ -Dsonar.github.oauth=$GITHUB_TOKEN \
+ -Dsonar.host.url=$SONAR_HOST_URL \
+ -Dsonar.login=$SONAR_TOKEN
+
+ else
+ echo 'Build feature branch or external pull request'
+
+ mvn install $MAVEN_ARGS -Dsource.skip=true
+ fi
+ ./run-integration-tests.sh "Lite" ""
;;
WEB_TESTS)