sonarqube/travis.sh

78 lines
2.4 KiB
Bash
Raw Normal View History

2015-06-03 11:41:53 +02:00
#!/bin/bash
set -euo pipefail
function installTravisTools {
2015-07-24 16:35:08 +02:00
mkdir ~/.local
2015-09-11 08:47:24 +02:00
curl -sSL https://github.com/SonarSource/travis-utils/tarball/v19 | tar zx --strip-components 1 -C ~/.local
2015-07-24 16:35:08 +02:00
source ~/.local/bin/install
}
2015-06-19 16:43:38 +02:00
case "$JOB" in
2015-06-03 11:41:53 +02:00
H2)
mvn verify -B -e -V
2015-06-03 11:41:53 +02:00
;;
POSTGRES)
installTravisTools
psql -c 'create database sonar;' -U postgres
2015-07-24 16:35:08 +02:00
runDatabaseCI "postgresql" "jdbc:postgresql://localhost/sonar" "postgres" ""
2015-06-03 11:41:53 +02:00
;;
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
2015-07-24 16:35:08 +02:00
runDatabaseCI "mysql" "jdbc:mysql://localhost/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance" "sonar" "sonar"
2015-06-03 11:41:53 +02:00
;;
WEB)
2015-09-10 10:16:31 +02:00
installTravisTools
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16
wget http://selenium-release.storage.googleapis.com/2.46/selenium-server-standalone-2.46.0.jar
2015-07-02 17:33:18 +02:00
nohup java -jar selenium-server-standalone-2.46.0.jar &
sleep 3
2015-09-10 10:16:31 +02:00
cd server/sonar-web && npm install && npm test
;;
2015-06-19 16:43:38 +02:00
PRANALYSIS)
2015-08-27 09:00:55 +02:00
if [ -n "$SONAR_GITHUB_OAUTH" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
2015-06-19 16:43:38 +02:00
echo "Start pullrequest analysis"
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify sonar:sonar -B -e -V -Dmaven.test.failure.ignore=true -Dclirr=true \
-Dsonar.analysis.mode=incremental \
2015-06-19 16:43:38 +02:00
-Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
-Dsonar.github.repository=$SONAR_GITHUB_REPOSITORY \
-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_PASSWD
fi
2015-06-19 16:43:38 +02:00
;;
ITS)
if [ "$IT_CATEGORY" == "plugins" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
2015-08-27 09:00:55 +02:00
echo "Ignore this job since it needs access to private test licenses."
else
2015-09-10 10:16:31 +02:00
installTravisTools
start_xvfb
2015-09-02 12:13:48 +02:00
CATEGORIES=($(echo "$IT_CATEGORY" | tr '_' '\n'))
CATEGORY1=${CATEGORIES[0]:-'NONE'}
CATEGORY2=${CATEGORIES[1]:-'NONE'}
mvn install -Pit,dev -DskipTests -Dcategory1="$CATEGORY1" -Dcategory2="$CATEGORY2" -Dmaven.test.redirectTestOutputToFile=false -e -Dsource.skip=true
2015-08-27 09:00:55 +02:00
fi
2015-06-19 16:43:38 +02:00
;;
2015-06-03 11:41:53 +02:00
esac