blob: 59af62537aa45f1a61aa2ab8f94b4e7435e01fc7 (
plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#!/bin/bash
set -euo pipefail
function installTravisTools {
mkdir ~/.local
curl -sSL https://github.com/SonarSource/travis-utils/tarball/v19 | tar zx --strip-components 1 -C ~/.local
source ~/.local/bin/install
}
case "$JOB" in
H2)
mvn verify -B -e -V
;;
POSTGRES)
installTravisTools
psql -c 'create database sonar;' -U postgres
runDatabaseCI "postgresql" "jdbc:postgresql://localhost/sonar" "postgres" ""
;;
MYSQL)
installTravisTools
mysql -e "CREATE DATABASE sonar CHARACTER SET UTF8;" -uroot
mysql -e "CREATE USER 'sonar'@'localhost' IDENTIFIED BY 'sonar';" -uroot
mysql -e "GRANT ALL ON sonar.* TO 'sonar'@'localhost';" -uroot
mysql -e "FLUSH PRIVILEGES;" -uroot
runDatabaseCI "mysql" "jdbc:mysql://localhost/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance" "sonar" "sonar"
;;
WEB)
set +eu
source ~/.nvm/nvm.sh && nvm install 4
cd server/sonar-web && npm install && npm test
;;
PULL_REQUEST_ANALYSIS)
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; 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
if [ -n "$SONAR_GITHUB_OAUTH" ]; then
# 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
echo "Analyze pull request"
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify sonar:sonar -B -e -V -Panalysis \
-Dmaven.test.failure.ignore=true \
-Dclirr=true \
-Dsonar.analysis.mode=issues \
-Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
-Dsonar.github.repository=$TRAVIS_REPO_SLUG \
-Dsonar.github.login=$SONAR_GITHUB_LOGIN \
-Dsonar.github.oauth=$SONAR_GITHUB_OAUTH \
-Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.login=$SONAR_LOGIN \
-Dsonar.password=$SONAR_PASSWORD
else
echo "Pull requests are not analyzed when coming from outside repositories"
fi
fi
;;
ITS)
if [ "$IT_CATEGORY" == "Plugins" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "Ignore this job since it needs access to private test licenses."
else
installTravisTools
start_xvfb
mvn install -Pit,dev -DskipTests -Dcategory=$IT_CATEGORY -Dmaven.test.redirectTestOutputToFile=false -e -Dsource.skip=true
fi
;;
esac
|