From: David Gageot Date: Wed, 3 Jun 2015 09:41:53 +0000 (+0200) Subject: Run CI on h2/mysql/postgres X-Git-Tag: 5.2-RC1~1646 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8f9e5e843e070afdf05cf0c9b4f1479e45e25542;p=sonarqube.git Run CI on h2/mysql/postgres --- diff --git a/.travis.yml b/.travis.yml index 3cd109e4593..b3ab2939fe7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,12 +5,19 @@ install: true jdk: - oraclejdk8 +env: + - DATABASE=H2 + - DATABASE=POSTGRES + - DATABASE=MYSQL + script: - - mvn verify -B -e -V + - ./travis.sh cache: directories: - '$HOME/.m2/repository' +before_cache: + - 'rm -rf $HOME/.m2/repository/org/codehaus/sonar' notifications: email: false diff --git a/travis.sh b/travis.sh new file mode 100755 index 00000000000..b8a1b126d3f --- /dev/null +++ b/travis.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -euo pipefail + +function installTravisTools { + curl -sSL https://raw.githubusercontent.com/dgageot/travis-utils/master/install.sh | sh + source /tmp/travis-utils/utils.sh +} + +case "$DATABASE" 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' + ;; + +*) + echo "Invalid DATABASE choice [$DATABASE]" + exit 1 + +esac