aboutsummaryrefslogtreecommitdiffstats
path: root/travis.sh
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2016-02-01 14:53:51 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2016-02-01 14:53:51 +0100
commit378a8d9d4636d80f3421f17e8b0209742b64a3c9 (patch)
tree39bcadecbca28609a6733ccd7e5865ed020b1619 /travis.sh
parentba5c553c7e536c293050a4c1b320887881c70749 (diff)
downloadsonar-scanner-cli-378a8d9d4636d80f3421f17e8b0209742b64a3c9.tar.gz
sonar-scanner-cli-378a8d9d4636d80f3421f17e8b0209742b64a3c9.zip
Fix build
- upgrade orchestrator from 3.9-SNAPSHOT to 3.9 - use latest parent pom in integration tests - support Java 7 for analysis from Travis
Diffstat (limited to 'travis.sh')
-rwxr-xr-xtravis.sh77
1 files changed, 36 insertions, 41 deletions
diff --git a/travis.sh b/travis.sh
index 91903a6..5f2ca30 100755
--- a/travis.sh
+++ b/travis.sh
@@ -2,11 +2,12 @@
set -euo pipefail
-function installTravisTools {
+function configureTravis {
mkdir -p ~/.local
- curl -sSL https://github.com/SonarSource/travis-utils/tarball/v21 | tar zx --strip-components 1 -C ~/.local
+ curl -sSL https://github.com/SonarSource/travis-utils/tarball/v23 | tar zx --strip-components 1 -C ~/.local
source ~/.local/bin/install
}
+configureTravis
function strongEcho {
echo ""
@@ -17,56 +18,52 @@ case "$TARGET" in
CI)
if [ "${TRAVIS_BRANCH}" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
- strongEcho 'Build and analyze commit in master'
- # this commit is master must be built and analyzed (with upload of report)
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify -Pcoverage-per-test -Dmaven.test.redirectTestOutputToFile=false -B -e -V
+ strongEcho 'Build, deploy and analyze master'
- # 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
+ SONAR_PROJECT_VERSION=`maven_expression "project.version"`
+
+ # Do not deploy a SNAPSHOT version but the release version related to this build
+ set_maven_build_version $TRAVIS_BUILD_NUMBER
export MAVEN_OPTS="-Xmx1G -Xms128m"
- mvn sonar:sonar -B -e -V \
- -Dsonar.host.url=$SONAR_HOST_URL \
- -Dsonar.login=$SONAR_TOKEN
-
-
- elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "$GITHUB_TOKEN" ]; 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
- # That's why the analysis does not need to be executed if the variable SONAR_GITHUB_OAUTH is not defined.
-
- strongEcho 'Build and analyze pull request'
- # this pull request must be built and analyzed (without upload of report)
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify -Pcoverage-per-test -Dmaven.test.redirectTestOutputToFile=false -B -e -V
-
- # 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
-
- mvn sonar:sonar -B -e -V \
- -Dsonar.analysis.mode=issues \
+ mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy sonar:sonar \
+ -Pcoverage-per-test,deploy-sonarsource \
+ -Dmaven.test.redirectTestOutputToFile=false \
+ -Dsonar.host.url=$SONAR_HOST_URL \
+ -Dsonar.login=$SONAR_TOKEN \
+ -Dsonar.projectVersion=$SONAR_PROJECT_VERSION \
+ -B -e -V
+
+ elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN-}" ]; then
+ strongEcho 'Build and analyze pull request, no deploy'
+
+ # No need for Maven phase "install" as the generated JAR file does not need to be installed
+ # in Maven local repository. Phase "verify" is enough.
+
+ mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify sonar:sonar \
+ -Dmaven.test.redirectTestOutputToFile=false \
+ -Dsonar.analysis.mode=issues \
-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
-
+ -Dsonar.login=$SONAR_TOKEN \
+ -B -e -V
else
- strongEcho 'Build, no analysis'
- # Build branch, without any analysis
+ strongEcho 'Build, no analysis, no deploy'
- # No need for Maven goal "install" as the generated JAR file does not need to be installed
- # in Maven local repository
- mvn verify -Dmaven.test.redirectTestOutputToFile=false -B -e -V
+ # No need for Maven phase "install" as the generated JAR file does not need to be installed
+ # in Maven local repository. Phase "verify" is enough.
+
+ mvn verify \
+ -Dmaven.test.redirectTestOutputToFile=false \
+ -B -e -V
fi
;;
IT)
- installTravisTools
- if [ "${SQ_VERSION}" == "DEV" ]
+ if [ "${SQ_VERSION}" = "DEV" ]
then
build_snapshot "SonarSource/sonarqube"
fi
@@ -76,9 +73,7 @@ IT)
cd it
- build_snapshot "SonarSource/orchestrator"
-
- mvn -Dsonar.runtimeVersion="$SQ_VERSION" -Dmaven.test.redirectTestOutputToFile=false verify
+ mvn -Dsonar.runtimeVersion="$SQ_VERSION" -Dmaven.test.redirectTestOutputToFile=false verify -e -B -V
;;
*)