forked from WordPress/HelpHub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
94 lines (86 loc) · 2.69 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
# Travis CI configuration file.
# @link https://travis-ci.org/
# For use with the HelpHub project
# Declare project language and PHP versions to test against.
# @link http://about.travis-ci.org/docs/user/languages/php/
language: php
# Tell Travis CI which distro to use
dist: trusty
# Travis CI environment matrix
matrix:
fast_finish: true
include:
# Declare versions of PHP to use, w.org currently uses 7.2, soon to be 7.3
- php: 7.3
env: WP_VERSION=latest WP_MULTISITE=0 SNIFF=1
- php: 7.3
env: WP_VERSION=nightly WP_MULTISITE=0
- php: 7.2
env: WP_VERSION=latest WP_MULTISITE=0
- php: 7.2
env: WP_VERSION=nightly WP_MULTISITE=0
# Setup NPM modules for Travis CI cache maintanence.
cache:
directories:
- $HOME/.npm
- node_modules
- $HOME/.composer/cache
- $HOME/.cache/composer/files
before_install:
- npm prune
- npm update
# 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:
- |
# 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
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- |
if [[ "$SNIFF" == "1" ]]; then
composer install --no-suggest --no-interaction
else
composer global require --dev phpunit/phpunit ^6
fi
- which phpunit
- |
if [[ "$SNIFF" == "1" ]]; then
vendor/bin/phpunit --version
else
phpunit --version
fi
# Install phpunuit test suite
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
# 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:
# PHPCS WordPress Coding Standards
- if [[ "$SNIFF" == "1" ]]; then vendor/bin/phpcs -v --runtime-set ignore_warnings_on_exit 1;fi
# Change to the themes folder
- cd themes
# Search theme for PHP syntax errors.
- find . \( -name '*.php' \) -exec php -lf {} \;
# Change to the plugins folder
- cd .. && cd plugins
# Search theme for PHP syntax errors.
- find . \( -name '*.php' \) -exec php -lf {} \;
# Setup NodeJS version using NVM
- node --version
- npm --version
- nvm install 8
- npm --version
- node --version
# Install NPM modules
- npm install
- npm install -g grunt-cli
# Run CSS, JS, & PHP Grunt tasks (Temporarily using --force so all tasks run)
- grunt travis
# PHPUnit
- cd ..
- if [[ "$SNIFF" == "1" ]]; then vendor/bin/phpunit; else phpunit;fi