Skip to content

Commit 8c07e28

Browse files
committed
Add SonarQube analysis on sonarcloud.io
1 parent 78354e6 commit 8c07e28

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

.travis.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
dist: trusty
2+
sudo: required
3+
14
language: java
25

36
jdk:
47
- oraclejdk8
58

69
addons:
7-
apt:
8-
packages:
9-
- oracle-java8-installer
10+
sonarqube:
11+
organization: racodond-github
12+
token:
13+
secure: ...
14+
github_token:
15+
secure: ...
1016

1117
env:
1218
global:
@@ -20,5 +26,6 @@ env:
2026
cache:
2127
directories:
2228
- '$HOME/.m2/repository'
29+
- '$HOME/.sonar/cache'
2330

2431
script: ./travis.sh

travis.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ set -euo pipefail
44

55
mvn -B clean install
66

7+
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$SQ_VERSION" == "LTS" ]; then
8+
mvn -B sonar:sonar \
9+
-Dsonar.host.url=https://sonarcloud.io \
10+
-Dsonar.analysis.mode=preview \
11+
-Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
12+
-Dsonar.github.repository=$TRAVIS_REPO_SLUG \
13+
-Dsonar.github.oauth=$GITHUB_TOKEN \
14+
-Dsonar.login=$SONAR_TOKEN
15+
16+
elif [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$SQ_VERSION" == "LTS" ]; then
17+
mvn -B sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN
18+
fi
19+
720
cd its
821
mvn -B clean install -Dsonar.runtimeVersion=$SQ_VERSION
9-

0 commit comments

Comments
 (0)