forked from piotrczy/sonar-json-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travis.sh
executable file
·23 lines (17 loc) · 832 Bytes
/
travis.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
set -euo pipefail
mvn -B clean install -Pits -Dmaven.test.skip -Dlicense.skip -Dsonar.runtimeVersion=$SQ_VERSION
if [ "$SQ_VERSION" == "LTS" ]; then
mvnCommand='mvn -B sonar:sonar'
commonArgs="-Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dsonar.organization=racodond-github"
githubArgs="-Dsonar.analysis.mode=preview -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST -Dsonar.github.repository=$TRAVIS_REPO_SLUG -Dsonar.github.oauth=$GITHUB_TOKEN"
branchArgs=''
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
if [ "$TRAVIS_BRANCH" != "master" ]; then
branchArgs="-Dsonar.branch.name=$TRAVIS_BRANCH -Dsonar.branch.target=master"
fi
eval $mvnCommand $commonArgs $branchArgs
else
eval $mvnCommand $commonArgs $githubArgs
fi
fi