-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
.travis.yml
55 lines (49 loc) · 2.87 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# This script is used by Travis CI to run automatically Continuous test integration
# from Dolibarr GitHub repository.
# Command run is phpunit
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
services:
- memcached # will start memcached
# This will tell travis to run phpunit
language: php
php:
- "5.4"
env:
- DB=mysql
# - DB=postgres
before_script:
- echo Start travis
- echo Current dir is `pwd`
- echo Home dir is `echo ~`
- echo Create dir /home/travis/build/Dolibarr/dolibarr/documents
- mkdir -p /home/travis/build/Dolibarr/dolibarr/documents/admin/temp; chmod -R a+rwx /home/travis/build/Dolibarr/dolibarr/documents;
- echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "extension = xdebug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo Init database
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS myapp_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE myapp_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS myapp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS myapp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < /home/travis/build/Dolibarr/dolibarr/dev/initdata/mysqldump_dolibarr_3.5.0.sql; fi"
- echo Create config file htdocs/conf/conf.php
- echo '<?php ' > htdocs/conf/conf.php
- sh -c "if [ '$DB' = 'pgsql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> htdocs/conf/conf.php; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then echo '$'dolibarr_main_db_type=\'mysqli\'';' >> htdocs/conf/conf.php; fi"
- echo '$'dolibarr_main_url_root=\'http://localhost/dolibarr\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_document_root=\'/home/travis/build/Dolibarr/dolibarr/htdocs\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_data_root=\'/home/travis/build/Dolibarr/dolibarr/documents\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_host=\'localhost\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_name=\'myapp_test\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_user=\'travis\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> htdocs/conf/conf.php
- echo '?>' >> htdocs/conf/conf.php
- echo Show conf.php content
- cat htdocs/conf/conf.php
# Omitting "script:" will default to phpunit
# use the $DB env variable to determine the phpunit.xml to use
script: phpunit --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php
after_script:
- echo End travis