-
Notifications
You must be signed in to change notification settings - Fork 78
/
.travis.yml
91 lines (84 loc) · 2.44 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
## Travis CI Configuration File
sudo: false
language: php
dist: trusty
cache:
apt: true
directories:
- node_modules
- vendor
- $HOME/.composer/cache
- $HOME/opt/$TRAVIS_PHP_VERSION
addons:
apt:
packages:
- bc
# Test against these versions of PHP.
# Some additional PHP versions are also included in the matrix below.
php:
- '7.0'
- 7.1
- 7.2
- 7.3
# Test against these versions of WordPress.
env:
- WP_VERSION=5.7 # Plugin minimum version
- WP_VERSION=5.8
- WP_VERSION=5.9
- WP_VERSION=latest
before_script:
- |
# Export Composer's global bin dir to PATH, but not on PHP 5.2
if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]]; then
composer config --list --global
export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
fi
- |
# Remove Xdebug for a huge performance increase
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
phpenv config-rm xdebug.ini
else
echo "xdebug.ini does not exist"
fi
- |
# Install WordPress and PHPUnit
if [[ ! -z "$WP_VERSION" ]] ; then
bash tests/bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
case "$TRAVIS_PHP_VERSION" in
7.3|7.2|7.1|7.0|nightly)
echo "Using PHPUnit 6.x"
composer global require "phpunit/phpunit:^6"
;;
5.6|5.5|5.4|5.3)
echo "Using PHPUnit 4.x"
composer global require "phpunit/phpunit:^4"
;;
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
composer global require "yoast/phpunit-polyfills:^1.0"
fi
- |
# Install PHP_CodeSniffer if it's requested for this test
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
composer global require wp-coding-standards/wpcs
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
fi
script:
- |
# Run PHPUnit in both single site and multisite mode
if [[ ! -z "$WP_VERSION" && "$WP_TRAVISCI" != "phpcs" ]] ; then
phpunit --verbose
WP_MULTISITE=1 phpunit --verbose
fi
- |
# Run PHP_CodeSniffer coding standards if it's requested for this test
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
phpcs
fi