forked from alleyinteractive/apple-news
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
140 lines (119 loc) · 3.39 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Travis CI (MIT License) configuration file for Publish to Apple News
# @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 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
- ./vendor
- node_modules
# Git clone depth.
git:
depth: 1
matrix:
fast_finish: true
include:
- php: 7.3
env: WP_VERSION=latest PHP_LINT=1 WP_PHPCS=1 WP_JS=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"
- 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
# Install Composer dependencies.
- composer install
# 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
fi
# Set up jest.
- |
if [[ "$WP_JS" == "1" ]] ; then
nvm install 8
npm i -g npm@6
npm install
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 the plugin's unit tests in standalone mode.
- |
if [[ ! -z "$WP_VERSION" ]] ; then
phpunit
fi
# Run the plugin's unit tests in multisite mode.
- |
if [[ ! -z "$WP_VERSION" ]] ; then
WP_MULTISITE=1 phpunit
fi
# Run Jest tests.
- |
if [[ "$WP_JS" == "1" ]] ; then
npm run test
fi
# Test the build.
- |
if [[ "$WP_JS" == "1" ]] ; then
npm run build
fi
# Receive notifications for build results.
# @link http://docs.travis-ci.com/user/notifications/#Email-notifications
notifications:
email: false