forked from croogo/croogo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
109 lines (101 loc) · 3.82 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
language: php
sudo: false
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
env:
- DB=mysql
- DB=pgsql
matrix:
include:
- php: 7.1
env:
- DB=mysql PHPCOV=1
before_install:
- git clone --depth 1 git://github.com/croogo/app -b 2.3 app
- mkdir -p app/Vendor/cakephp app/Vendor/croogo
- git clone --depth 1 git://github.com/cakephp/cakephp -b 2.9.2 app/Vendor/cakephp/cakephp
- ln -s `pwd` app/Vendor/croogo/croogo
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ] ; then git clone --depth 1 git://github.com/CakeDC/search -b master app/Plugin/Search ; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ] ; then git clone --depth 1 git://github.com/CakeDC/migrations -b master app/Plugin/Migrations ; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ] ; then git clone --depth 1 git://github.com/croogo/Ckeditor -b master app/Plugin/Ckeditor ; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.2' ]; then composer global require 'phpunit/phpunit=3.7.33'; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.2' ]; then ln -s ~/.composer/vendor/phpunit/phpunit/PHPUnit app/Vendor/PHPUnit; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.2' ] ; then composer -n -vv install ; fi"
- for d in Plugin/* ; do if [ ! -f $app/$d ] ; then ln -s `pwd`/$d app/$d; fi ; done
before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE croogo_test;'; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE croogo_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA croogo_test;' -U postgres -d croogo_test; fi"
- cp app/Config/settings.json.install app/Config/settings.json
- cp app/Config/croogo.php.install app/Config/croogo.php
- sed -i "s/E_DEPRECATED,$/E_DEPRECATED \& ~E_USER_DEPRECATED,/" app/Config/croogo.php
- set +H
- echo "<?php
class DATABASE_CONFIG {
private \$identities = array(
'mysql' => array(
'datasource' => 'Database/Mysql',
'host' => 'localhost',
'login' => 'travis',
'database' => 'croogo_test',
),
'pgsql' => array(
'datasource' => 'Database/Postgres',
'host' => '127.0.0.1',
'login' => 'postgres',
'database' => 'croogo_test',
'schema' => array(
'default' => 'public',
'test' => 'croogo_test',
)
),
'sqlite' => array(
'datasource' => 'Database/Sqlite',
'database' => array(
'default' => ':memory:',
'test' => ':memory:',
),
)
);
public \$default = array(
'persistent' => false,
'host' => '',
'login' => '',
'password' => '',
'database' => 'croogo',
'prefix' => ''
);
public \$test = array(
'persistent' => false,
'host' => '',
'login' => '',
'password' => '',
'database' => 'croogo_test',
'prefix' => ''
);
public function __construct() {
\$db = 'mysql';
if (!empty(\$_SERVER['DB'])) {
\$db = \$_SERVER['DB'];
}
foreach (array('default', 'test') as \$source) {
\$config = array_merge(\$this->{\$source}, \$this->identities[\$db]);
if (is_array(\$config['database'])) {
\$config['database'] = \$config['database'][\$source];
}
if (!empty(\$config['schema']) && is_array(\$config['schema'])) {
\$config['schema'] = \$config['schema'][\$source];
}
\$this->{\$source} = \$config;
}
}
}" > app/Config/database.php
script:
- sh -c "if [ '$PHPCOV' = '1' ]; then cd app && ./Console/cake test croogo CroogoTests --stderr --coverage-clover ../coverage.clover && cd .. && wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; else cd app && ./Console/cake test croogo CroogoTests --stderr ; fi"
notifications:
email: false