-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
.travis.yml
95 lines (90 loc) · 2.71 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
sudo: false
dist: trusty
language: php
notifications:
email:
on_success: never
on_failure: change
cache:
directories:
- $HOME/.composer/cache
matrix:
include:
- php: 7.4
env: WP_VERSION=latest WP_MULTISITE=1 PHPLINT=1
- php: 7.3
env: WP_VERSION=latest WP_MULTISITE=1
- php: 7.2
env: WP_VERSION=latest WP_MULTISITE=1
- php: 5.6
env: WP_VERSION=latest WP_MULTISITE=1 PHPLINT=1
dist: precise
- php: 7.2
env: WP_VERSION=4.9 WP_MULTISITE=1
- php: 5.6
env: WP_VERSION=4.9 WP_MULTISITE=1
dist: precise
- php: nightly
env: WP_VERSION=master WP_MULTISITE=1
allow_failures:
- php: nightly
env: WP_VERSION=master WP_MULTISITE=1
before_script:
- |
if [[ "$COVERAGE" != "1" ]]; then
stable='^[0-9\.]+$'
if [[ "$TRAVIS_PHP_VERSION" =~ $stable ]]; then
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
phpenv config-rm xdebug.ini
fi
fi
fi
- |
case "$TRAVIS_PHP_VERSION" in
5.6|5.5|5.4|5.3)
composer global require "phpunit/phpunit:^4"
;;
5.2)
;;
*)
composer install --no-interaction
;;
esac
- |
if [[ "$WP_VERSION" == "latest" ]]; then
curl -s http://api.wordpress.org/core/version-check/1.7/ > /tmp/wp-latest.json
WP_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
fi
- PLUGIN_SLUG=$(basename $(pwd))
- export WP_DEVELOP_DIR=/tmp/wordpress/
- git clone --depth=50 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress
- cd ..
- mkdir -p /tmp/wordpress/src/wp-content/mu-plugins
- cp -r "$PLUGIN_SLUG" "/tmp/wordpress/src/wp-content/mu-plugins/$PLUGIN_SLUG"
- cd /tmp/wordpress/
- cp wp-tests-config-sample.php wp-tests-config.php
- sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
- sed -i "s/yourusernamehere/travis/" wp-tests-config.php
- sed -i "s/yourpasswordhere//" wp-tests-config.php
- mysql -e "CREATE DATABASE wordpress_tests;" -uroot
- cd "/tmp/wordpress/src/wp-content/mu-plugins/$PLUGIN_SLUG"
- phpenv rehash
script:
- |
if [[ "$PHPLINT" == "1" ]]; then
find -L . -path ./vendor -prune -o -name '*.php' -not -name 'class-wp-ms-network-command.php' -print0 | xargs -0 -n 1 -P 4 php -l
fi
- |
case "$TRAVIS_PHP_VERSION" in
5.6|5.5|5.4|5.3|5.2)
phpunit -c phpunit.xml.dist
;;
*)
if [[ "$COVERAGE" == "1" ]]; then
mkdir -p build/logs
vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/logs/clover.xml
else
vendor/bin/phpunit -c phpunit.xml.dist
fi
;;
esac