-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
101 lines (96 loc) · 3.66 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
language: php
sudo: false # Use modern Travis builds – http://docs.travis-ci.com/user/migrating-from-legacy/
git:
depth: 1
services:
- mysql
matrix:
include:
# current stable release w/ multisite
- php: "5.6"
env: WP_VERSION=latest WP_MULTISITE=0
- php: "7.0"
env: WP_VERSION=latest WP_MULTISITE=0
- php: "7.2"
env: WP_VERSION=latest WP_MULTISITE=0
- php: "7.3"
env: WP_VERSION=latest WP_MULTISITE=0
- php: "7.4"
env: WP_VERSION=latest WP_MULTISITE=0 SNIFF=1
# n-1 major release
- php: "5.6"
env: WP_VERSION=5.2.5 WP_MULTISITE=0
- php: "7.0"
env: WP_VERSION=5.2.5 WP_MULTISITE=0
- php: "7.2"
env: WP_VERSION=5.2.5 WP_MULTISITE=0
- php: "7.3"
env: WP_VERSION=5.2.5 WP_MULTISITE=0
# - skip PHP 7.4 and WP 5.2 (not compatible)
before_script:
- |
export PHPCS_DIR=/tmp/phpcs
export PHPUNIT_DIR=/tmp/phpunit
export SNIFFS_DIR=/tmp/sniffs
mkdir $PHPCS_DIR
mkdir $PHPUNIT_DIR
mkdir $SNIFFS_DIR
- |
# 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
- |
if [[ "$SNIFF" == "1" ]]; then
# Install CodeSniffer for WordPress Coding Standards checks.
wget -O $PHPCS_DIR/phpcs https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
chmod +x $PHPCS_DIR/phpcs
# Install WordPress Coding Standards.
git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $SNIFFS_DIR/WordPress-Coding-Standards
# Install WordPress VIP Coding Standards.
git clone -b master --depth 1 https://github.com/Automattic/VIP-Coding-Standards.git $SNIFFS_DIR/VIP-Coding-Standards
# Install PHP Compatibility sniffs.
git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $SNIFFS_DIR/PHPCompatibility
# Set install path for PHPCS sniffs.
echo $PHPCS_DIR/phpcs --config-set installed_paths $SNIFFS_DIR/PHPCompatibility,$SNIFFS_DIR/WordPress-Coding-Standards,$SNIFFS_DIR/VIP-Coding-Standards
$PHPCS_DIR/phpcs --config-set installed_paths $SNIFFS_DIR/PHPCompatibility,$SNIFFS_DIR/WordPress-Coding-Standards,$SNIFFS_DIR/VIP-Coding-Standards
# After CodeSniffer install you should refresh your path.
phpenv rehash
fi
- |
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
export PATH="$PHPUNIT_DIR:$PHPCS_DIR:$PATH"
- |
# Install WordPress and PHPUnit
if [[ ! -z "$WP_VERSION" ]] ; then
case "$TRAVIS_PHP_VERSION" in
7.4|7.3|7.2|7.1|7.0|nightly)
echo "Using PHPUnit 6.x"
wget -O $PHPUNIT_DIR/phpunit https://phar.phpunit.de/phpunit-6.5.9.phar
chmod +x $PHPUNIT_DIR/phpunit
;;
5.6|5.5|5.4|5.3)
echo "Using PHPUnit 4.x"
wget -O $PHPUNIT_DIR/phpunit https://phar.phpunit.de/phpunit-4.8.9.phar
chmod +x $PHPUNIT_DIR/phpunit
;;
5.2)
echo "Using PHPUnit 3.x"
wget -O $PHPUNIT_DIR/phpunit https://phar.phpunit.de/phpunit-3.7.9.phar
chmod +x $PHPUNIT_DIR/phpunit
;;
*)
echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION"
exit 1
;;
esac
fi
- |
script:
# Search for PHP syntax errors.
- find -L . -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
# WordPress Coding Standards.
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/phpcs -p -s -v -n --standard=WordPress-VIP-Go,WordPress,PHPCompatibility --runtime-set testVersion 5.6- --ignore=tests .; fi
- phpunit