]> source.dussan.org Git - sonarqube.git/commitdiff
Run CI on h2/mysql/postgres
authorDavid Gageot <david@gageot.net>
Wed, 3 Jun 2015 09:41:53 +0000 (11:41 +0200)
committerDavid Gageot <david@gageot.net>
Wed, 3 Jun 2015 16:02:47 +0000 (18:02 +0200)
.travis.yml
travis.sh [new file with mode: 0755]

index 3cd109e45937609afd809f15283377084eed7df7..b3ab2939fe7f7832eaebfdf52fefb716ca30dae8 100644 (file)
@@ -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 (executable)
index 0000000..b8a1b12
--- /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