forked from mautic/mautic-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
117 lines (109 loc) · 3.34 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
110
111
112
113
114
115
116
117
language: php
sudo: false
env:
global:
- WP_PHPUNIT=phpunit
- COMPOSER_DISABLE_XDEBUG_WARN=1
services:
- mysql
matrix:
fast_finish: true
include:
- php: 5.2
env: WP_VERSION=4.6 WP_MULTISITE=1
dist: precise
- php: 5.2
env: WP_VERSION=master
dist: precise
- php: 5.3
env: WP_VERSION=4.5
dist: precise
- php: 5.6
env: WP_VERSION=4.4
- php: 7.0
env: WP_VERSION=4.9
- php: 7.3
env: WP_VERSION=5.2
- php: 7.3
env: WP_VERSION=5.0 WP_MULTISITE=1 COVERAGE=1 OUTDATED=1
- php: 7.3
env: WP_VERSION=master
- php: hhvm
env: WP_VERSION=4.7
- php: nightly
env: WP_VERSION=master
allow_failures:
# Allow failures for unstable builds.
- php: nightly
- php: hhvm
- env: WP_VERSION=master
cache:
directories:
- vendor
- $HOME/.composer/cache
before_install:
- export WP_DEVELOP_DIR=/tmp/wordpress/
- git clone --depth=50 --branch="$WP_VERSION" git://develop.git.wordpress.org/ $WP_DEVELOP_DIR
- cd $WP_DEVELOP_DIR
- |
mysql -u root -e "CREATE DATABASE wordpress_tests;"
cp wp-tests-config-sample.php wp-tests-config.php
sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
sed -i "s/yourusernamehere/root/" wp-tests-config.php
sed -i "s/yourpasswordhere//" wp-tests-config.php
echo -n "define('SCRIPT_DEBUG', false);" >> wp-tests-config.php
svn checkout https://plugins.svn.wordpress.org/wordpress-importer/trunk tests/phpunit/data/plugins/wordpress-importer
- cd -
before_script:
- |
# Install the specified version of PHPUnit depending on the PHP version:
case "$TRAVIS_PHP_VERSION" in
7.3|7.2|7.1|hhvm|nightly)
echo "Using bundled PHPUnit (7.*)"
composer install --no-interaction --prefer-source
export WP_PHPUNIT=vendor/bin/phpunit
;;
7.0)
echo "Using bundled PHPUnit (6.5)"
composer global require "phpunit/phpunit=6.5.*"
export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
;;
5.6)
echo "Using PHPUnit 5.7"
composer global require "phpunit/phpunit=5.7.*"
export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
;;
5.5|5.4|5.3)
echo "Using PHPUnit 4.8"
composer global require "phpunit/phpunit=4.8.*"
export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
;;
5.2)
# Do nothing, use default PHPUnit 3.6.x
echo "Using default PHPUnit, hopefully 3.6"
;;
*)
echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION"
exit 1
;;
esac
script:
- |
if [[ "$OUTDATED" == "1" ]]; then
composer outdated --direct
fi
- |
# Run code sniff when library is loaded
if [ -f "vendor/bin/phpcs" ]; then
vendor/bin/phpcs -n --standard=phpcs.xml
fi
- |
# Run valid PHPUnit version depending environment
$WP_PHPUNIT --version
if [[ "$COVERAGE" == "1" ]]; then
$WP_PHPUNIT --coverage-clover=coverage.clover
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
else
$WP_PHPUNIT
fi