Laurent Destailleur 2 年之前
父節點
當前提交
941c91bd01
共有 1 個文件被更改,包括 32 次插入14 次删除
  1. 32 14
      .travis.yml

+ 32 - 14
.travis.yml

@@ -14,11 +14,12 @@ git:
 # Start on every boot
 services:
 - memcached
+- mysql
 - postgresql
 
 
-addons:
-  mariadb: '10'
+#addons:
+  #mariadb: 10.4
   # Force postgresql version
   #postgresql: '10'
   #apt:
@@ -117,8 +118,7 @@ before_install:
 
     psql postgresql://postgres:postgres@127.0.0.1:5432 -l -A
   fi
-
-
+ 
 install:
 - |
   if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
@@ -181,11 +181,12 @@ install:
   ls $TRAVIS_BUILD_DIR/htdocs/includes
   ls $TRAVIS_BUILD_DIR/htdocs/includes/bin
   echo
- 
- 
+
+
+
 before_script:
   - |
-    echo Start before_script
+    echo Start travis
     echo Current dir is `pwd`
     echo Home dir is `echo ~`
     echo TRAVIS_BUILD_DIR is $TRAVIS_BUILD_DIR
@@ -223,7 +224,7 @@ before_script:
 
   - |
     echo "Setting up database"
-    if [ "$DB" = 'postgresql' ]; then
+    if [ "$DB" = 'postgresqlxxxx' ]; then
       # Ensure we stop on error with set -e
       set +e
       echo "MySQL drop database"
@@ -261,11 +262,26 @@ before_script:
       sudo mysql -u root -ppassword -h 127.0.0.1 -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
     fi
     
+    if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
+      echo "MySQL drop database"
+      mysql -u root -e 'DROP DATABASE IF EXISTS travis;'
+      echo "MySQL create database"
+      mysql -u root -e "CREATE DATABASE IF NOT EXISTS travis CHARACTER SET = 'utf8';"
+      echo "MySQL list current users"
+      mysql -u root -e 'use mysql; select * from user;'
+      echo "MySQL create user"
+      mysql -u root -e "CREATE USER 'travis'@'127.0.0.1' IDENTIFIED BY 'password';"
+      echo "MySQL grant"
+      mysql -u root -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
+      echo "MySQL flush"
+      mysql -u root -e 'FLUSH PRIVILEGES;'
+      mysql -u root -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
+    fi
     if [ "$DB" = 'postgresql' ]; then
       echo "PGSQL"
       sudo mkdir -p /tmp/pgloader
       sudo chmod -R a+rwx /tmp/pgloader/
-      sudo pgloader 'mysql://root:password@127.0.0.1/travis' 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
+      sudo pgloader 'mysql://root@127.0.0.1/travis' 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
       echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
       echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
       # Create pgsql compatibility functions
@@ -281,8 +297,8 @@ before_script:
     echo '$'dolibarr_main_document_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $CONF_FILE
     echo '$'dolibarr_main_data_root=\'$TRAVIS_BUILD_DIR/documents\'';' >> $CONF_FILE
     echo '$'dolibarr_main_db_host=\'127.0.0.1\'';' >> $CONF_FILE
-    echo '$'dolibarr_main_db_name=\'root\'';' >> $CONF_FILE
-    echo '$'dolibarr_main_db_user=\'password\'';' >> $CONF_FILE
+    echo '$'dolibarr_main_db_name=\'travis\'';' >> $CONF_FILE
+    echo '$'dolibarr_main_db_user=\'travis\'';' >> $CONF_FILE
     echo '$'dolibarr_main_instance_unique_id=\'travis1234567890\'';' >> $CONF_FILE
     if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
       echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE
@@ -292,7 +308,7 @@ before_script:
       echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
       echo '$'dolibarr_main_db_port=5432';' >> $CONF_FILE
     fi
-    echo '$'dolibarr_main_db_port=\'password\'';' >> $CONF_FILE
+    #echo '$'dolibarr_main_db_port=\'password\'';' >> $CONF_FILE
     echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
     cat $CONF_FILE
     echo
@@ -313,6 +329,8 @@ before_script:
   - sudo cat /etc/apache2/sites-available/000-default.conf
   - sudo service apache2 restart
 
+
+
 script:
 - |
   echo "Checking webserver availability by a wget -O - --debug http://127.0.0.1"
@@ -371,11 +389,11 @@ script:
   echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE
   if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
     echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE
-    echo '$'force_install_port=\'3306\'';' >> $INSTALL_FORCED_FILE
+    echo '$'force_install_port=3306';' >> $INSTALL_FORCED_FILE
   fi
   if [ "$DB" = 'postgresql' ]; then
     echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE
-    echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE
+    echo '$'force_install_port=5432';' >> $INSTALL_FORCED_FILE
   fi
   echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE
   echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE