-
Notifications
You must be signed in to change notification settings - Fork 22
/
.travis.yml
108 lines (94 loc) · 2.93 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
# Travis CI (MIT License) configuration file for WP Updates Notifier Plugin
# @link https://travis-ci.org/
# Xenial image has PHP versions 5.6,7.1,7.2 pre-installed
dist: xenial
# Xenial does not start mysql or memcached by default
services:
- mysql
- memcached
# Declare project language.
# @link http://about.travis-ci.org/docs/user/languages/php/
language: php
# Specify when Travis should build.
branches:
only:
- master
cache:
directories:
- $HOME/.composer/cache
matrix:
fast_finish: true
include:
- php: 7.3
env: WP_VERSION=latest PHP_LINT=1 WP_PHPCS=1
- php: 7.2
env: WP_VERSION=latest PHP_LINT=1
- php: 7.1
env: WP_VERSION=latest PHP_LINT=1
- php: 7.0
env: WP_VERSION=latest PHP_LINT=1
- php: 5.6
env: WP_VERSION=latest PHP_LINT=1
- php: 7.3
env: WP_VERSION=nightly
# Use this to prepare your build for testing.
# e.g. copy database configurations, environment variables, etc.
# Failures in this section will result in build status 'errored'.
before_script:
# Turn off Xdebug. See https://core.trac.wordpress.org/changeset/40138.
- phpenv config-rm xdebug.ini || echo "Xdebug not available"
# This path addition is needed for phpcs.
- export PATH="$HOME/.composer/vendor/bin:$PATH"
# Couple the PHPUnit version to the PHP version.
- |
case "$TRAVIS_PHP_VERSION" in
7.*)
echo "Using PHPUnit 6.1"
composer global require "phpunit/phpunit=6.1.*"
;;
*)
echo "Using PHPUnit 4.8"
composer global require "phpunit/phpunit=4.8.*"
;;
esac
# # Set up WordPress installation.
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
# Set up phpcs.
- |
if [[ "$WP_PHPCS" == "1" ]] ; then
composer global require automattic/vipwpcs
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/automattic/vipwpcs
phpcs --config-show
fi
# Run test script commands.
# Default is specific to project language.
# All commands must exit with code 0 on success. Anything else is considered failure.
script:
# Search for PHP syntax errors.
#
# Only need to run this once per PHP version.
- |
if [[ "$PHP_LINT" == "1" ]] ; then
find . -type "f" -iname "*.php" -not -path "./vendor/*" | xargs -L "1" php -l
fi
#
# WordPress Coding Standards.
#
# These are the same across PHP and WordPress, so we need to run them only once.
#
# @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
# @link http://pear.php.net/package/PHP_CodeSniffer/
- |
if [[ "$WP_PHPCS" == "1" ]] ; then
phpcs
fi
# Run phpunit and phpunit multi-site.
- |
if [[ ! -z "$WP_VERSION" ]] ; then
phpunit
WP_MULTISITE=1 phpunit
fi
# Receive notifications for build results.
# @link http://docs.travis-ci.com/user/notifications/#Email-notifications
notifications:
email: false