.travis.yml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. # This script is used by Travis CI to run automatically Continuous test integration
  2. # from Dolibarr GitHub repository.
  3. # Command run is phpunit
  4. # For syntax, see http://about.travis-ci.org/docs/user/languages/php/
  5. notifications:
  6. email:
  7. on_success: never # [always|never|change] default: change
  8. on_failure: change # [always|never|change] default: always
  9. addons:
  10. postgresql: "9.3"
  11. services:
  12. - memcached # will start memcached
  13. # This will tell travis to run phpunit
  14. language: php
  15. php:
  16. # - "5.2" is not supported because pyrus to install PHP_Codesniffer is not available
  17. - 5.3
  18. - 5.4
  19. - 5.5
  20. - 5.6
  21. - 7.0
  22. matrix:
  23. allow_failures:
  24. - php: 7.0
  25. env:
  26. - DB=mysql
  27. # - DB=postgres
  28. before_script:
  29. - echo Start travis
  30. - echo Current dir is `pwd`
  31. - echo Home dir is `echo ~`
  32. - export PHPV=`phpenv version-name`
  33. - echo PHP version $PHPV
  34. # - echo Update composer
  35. # - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update
  36. - echo PHPUnit version
  37. - which phpunit
  38. - phpunit --version
  39. - echo Install phpcs then show installed rules
  40. - pyrus install pear/PHP_CodeSniffer
  41. - phpenv rehash
  42. - which phpcs
  43. - phpcs --version
  44. - phpcs -i
  45. - echo Create dir $(pwd)/htdocs/documents
  46. - sudo mkdir -p $(pwd)/htdocs/documents/admin/temp;
  47. - sudo touch $(pwd)/htdocs/documents/dolibarr.log;
  48. - sudo chmod a+rwx /home; sudo chmod a+rwx /home/travis; sudo chmod -R a+rwx /home/travis/build;
  49. - sudo chmod -R a+rwx $(pwd);
  50. - sudo chown -R www-data:travis $(pwd)/htdocs/documents;
  51. - find $(pwd)/htdocs/documents -type d -exec ls -alt {} \;
  52. - echo Edit php.ini file
  53. - echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
  54. # - echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
  55. - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
  56. - sh -c "if [ '$PHPV' = '5.3' ]; then echo 'extension = apc.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
  57. - sh -c "if [ '$PHPV' = '5.4' ]; then echo 'extension = apc.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
  58. - sh -c "if [ '$PHPV' = '5.3' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
  59. - sh -c "if [ '$PHPV' = '5.4' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
  60. - cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
  61. - echo Mysql version
  62. # INSTALL MYSQL 5.6
  63. # (https://github.com/piwik/piwik/commit/20bd2e1c24e5d673dce3feb256204ad48c29f160)
  64. # TODO: Remove when mysql 5.6 is provided by travis.
  65. # Otherwise, our migrations will raise a syntax error.
  66. - "sudo apt-get remove mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5"
  67. - "sudo apt-get autoremove"
  68. - "sudo apt-get install libaio1"
  69. - "wget -O mysql-5.6.14.deb http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.14-debian6.0-x86_64.deb/from/http://cdn.mysql.com/"
  70. - "sudo dpkg -i mysql-5.6.14.deb"
  71. - "sudo cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql.server"
  72. - "sudo ln -s /opt/mysql/server-5.6/bin/* /usr/bin/"
  73. - "sudo sed -i'' 's/table_cache/table_open_cache/' /etc/mysql/my.cnf"
  74. - "sudo sed -i'' 's/log_slow_queries/slow_query_log/' /etc/mysql/my.cnf"
  75. - "sudo sed -i'' 's/basedir[^=]\\+=.*$/basedir = \\/opt\\/mysql\\/server-5.6/' /etc/mysql/my.cnf"
  76. - "sudo /etc/init.d/mysql.server start"
  77. - mysql --version
  78. - mysql -e "SELECT VERSION();"
  79. # /END MYSQL 5.6- mysql --version
  80. - echo Init database
  81. - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS myapp_test;' -U postgres; fi"
  82. - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE myapp_test;' -U postgres; fi"
  83. - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS myapp_test;'; fi"
  84. - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS myapp_test;'; fi"
  85. - sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.5.0.sql; fi"
  86. - echo Create config file htdocs/conf/conf.php
  87. - echo '<?php ' > htdocs/conf/conf.php
  88. - sh -c "if [ '$DB' = 'pgsql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> htdocs/conf/conf.php; fi"
  89. - sh -c "if [ '$DB' = 'mysql' ]; then echo '$'dolibarr_main_db_type=\'mysqli\'';' >> htdocs/conf/conf.php; fi"
  90. - echo '$'dolibarr_main_url_root=\'http://localhost/\'';' >> htdocs/conf/conf.php
  91. - echo '$'dolibarr_main_document_root=\'$(pwd)/htdocs\'';' >> htdocs/conf/conf.php
  92. - echo '$'dolibarr_main_data_root=\'$(pwd)/htdocs/documents\'';' >> htdocs/conf/conf.php
  93. - echo '$'dolibarr_main_db_host=\'localhost\'';' >> htdocs/conf/conf.php
  94. - echo '$'dolibarr_main_db_name=\'myapp_test\'';' >> htdocs/conf/conf.php
  95. - echo '$'dolibarr_main_db_user=\'travis\'';' >> htdocs/conf/conf.php
  96. - echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> htdocs/conf/conf.php
  97. - echo '?>' >> htdocs/conf/conf.php
  98. - echo Show conf.php content
  99. - cat htdocs/conf/conf.php
  100. - echo Install apache server
  101. - sudo apt-get update
  102. - sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl php5-mysql php5-pgsql php5-intl
  103. - sudo sed -i -e "s,/var/www,$(pwd)/htdocs,g" /etc/apache2/sites-available/default
  104. - echo Show default virtual host
  105. - sudo cat /etc/apache2/sites-available/default
  106. - sudo /etc/init.d/apache2 restart
  107. - wget http://localhost/
  108. - sudo cat /etc/apache2/envvars
  109. - sudo cat /var/log/apache2/error.log
  110. - cat index.html
  111. script:
  112. - cd htdocs/install
  113. - date
  114. # - php upgrade.php 3.4.0 3.5.0 ignoredbversion > upgrade340350.log
  115. # - php upgrade2.php 3.4.0 3.5.0 ignoredbversion > upgrade340350-2.log
  116. - php upgrade.php 3.5.0 3.6.0 ignoredbversion > upgrade350360.log
  117. - php upgrade2.php 3.5.0 3.6.0 ignoredbversion > upgrade350360-2.log
  118. - php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log
  119. - php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log
  120. - php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log
  121. # - cat upgrade370380.log
  122. - php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
  123. # - cat upgrade370380-2.log
  124. - cd ../..
  125. - date
  126. - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
  127. - date
  128. # - phpcs -p --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php 2>&1
  129. - phpcs -p --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/htdocs/conf/conf.php,/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ . 2>&1
  130. - date
  131. after_script:
  132. # - echo Output dolibarr log file; cat $(pwd)/htdocs/documents/dolibarr.log
  133. - echo Output apache log file; sudo cat /var/log/apache2/error.log
  134. - echo End travis