aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml9
-rwxr-xr-xtravis.sh39
2 files changed, 47 insertions, 1 deletions
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