diff --git a/.travis.yml b/.travis.yml
index bf34c86bd58c5fb114b44ac7e6937f2b1943bdee..657972a31de3b536701542907a7240c804a02d28 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,16 +17,22 @@ php:
addons:
mariadb: '10.0'
- # FIXME: find a way to import a MySQL dump into PostgreSQL
- #postgresql: '9.3'
+ postgresql: '9.3'
apt:
+ sources:
+ # To use the last version of pgloader, we add repo of postgresql
+ - postgresql
+ - sourceline: 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main'
+ - key_url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
packages:
# We need a webserver to test the webservices
# Let's install Apache with.
- apache2
# mod_php is not supported by Travis. Add fcgi. We install FPM later on.
- libapache2-mod-fastcgi
-
+ # We need pgloader for import mysql database into pgsql
+ - pgloader
+
# Start on every boot
services:
- memcached
@@ -39,8 +45,7 @@ env:
# MariaDB overrides MySQL installation so it's not possible to test both yet
#- DB=mysql
- DB=mariadb
- # FIXME: find a way to import a MySQL dump into PostgreSQL
- #- DB=postgresql
+ - DB=postgresql
# TODO
#- DB=sqlite
# See https://docs.travis-ci.com/user/languages/php/#Apache-%2B-PHP
@@ -77,6 +82,13 @@ before_install:
phpenv config-rm xdebug.ini
echo
+- |
+ if [ "$DB" = 'postgresql' ]; then
+ echo "Check pgloader version"
+ pgloader --version
+ echo
+ fi
+
install:
- |
echo "Updating Composer"
@@ -132,10 +144,10 @@ before_script:
echo "Set timezone"
echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then
- echo
- echo "Enabling APC for PHP <= 5.4"
+ #echo
+ #echo "Enabling APC for PHP <= 5.4"
# Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6!
- echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
+ #echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
echo
echo "Enabling Memcached for PHP <= 5.4"
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1 and nightly!
@@ -164,16 +176,18 @@ before_script:
- |
echo "Setting up database"
- if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
+ if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
echo "MySQL"
mysql -e 'DROP DATABASE IF EXISTS travis;'
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
+ mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
+ mysql -e 'FLUSH PRIVILEGES;'
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
fi
- # FIXME: find a way to import a MySQL dump into PostgreSQL
- #if [ "$DB" = 'postgresql' ]; then
- # pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
- #fi
+ if [ "$DB" = 'postgresql' ]; then
+ #pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
+ pgloader mysql://root@127.0.0.1/travis postgresql:///travis
+ fi
# TODO: SQLite
echo
@@ -190,10 +204,9 @@ before_script:
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE
fi
- # FIXME
- #if [ "$DB" = 'postgresql' ]; then
- # echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
- #fi
+ if [ "$DB" = 'postgresql' ]; then
+ echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
+ fi
# TODO: SQLite
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
cat $CONF_FILE