This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
travis.sh
executable file
·41 lines (34 loc) · 1.43 KB
/
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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN}" ] && [ -n "${SONAR_TOKEN}" ]; then
echo "Pull request"
PROJECT_VERSION=`cat pom.xml|grep version -m 1|sed -e \'s/.*<version>//\'|sed -e \'s/<.*//\'`
sh sonar-scanner/bin/sonar-scanner -Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.analysis.mode=issues \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.projectKey=$SONAR_PROJECT_KEY \
-Dsonar.projectName=mecm-reader \
-Dsonar.projectVersion=$PROJECT_VERSION \
-Dsonar.sources=src \
-Dsonar.java.source=1.8 \
-Dsonar.github.oauth=$GITHUB_TOKEN \
-Dsonar.github.repository=$TRAVIS_REPO_SLUG \
-Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST
set -e
mvn clean test -DrepoToken=$COVERALLS_TOKEN -DskipCoverage=false
set +e
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ $TRAVIS_BRANCH == "develop" ]; then
echo "Develop build"
PROJECT_VERSION=`cat pom.xml|grep version -m 1|sed -e \'s/.*<version>//\'|sed -e \'s/<.*//\'`
sh sonar-scanner/bin/sonar-scanner -Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.analysis.mode=publish \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.projectKey=$SONAR_PROJECT_KEY \
-Dsonar.projectName=mecm-reader \
-Dsonar.projectVersion=$PROJECT_VERSION \
-Dsonar.sources=src \
-Dsonar.java.source=1.8
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ $TRAVIS_BRANCH == "master" ]; then
echo "Master build"
else
echo "Push to branch"
fi