-
Notifications
You must be signed in to change notification settings - Fork 97
/
.travis.yml
153 lines (136 loc) · 5.18 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
141
142
143
144
145
146
147
148
149
150
151
152
153
# Travis CI Configuration File
# Use new Travis container-based infrastructure
# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
sudo: false
language: php
node_js:
- 8
- 10
dist: trusty
cache:
apt: true
directories:
- $HOME/.composer/cache/files
- $HOME/.npm
- /tmp/node
git:
depth: 10
php:
- 7.3
#- 7.2
#- 5.6
# WordPress comes from the Git mirror, where 'master' mirrors svn 'trunk' and
# x.y mirrors the latest from the x.y branch
#env:
# - WP_VERSION=master BP_TRAVISCI=travis:phpunit
# - WP_VERSION=5.2 BP_TRAVISCI=travis:phpunit
# - WP_VERSION=5.1 BP_TRAVISCI=travis:phpunit
# - WP_VERSION=5.0 BP_TRAVISCI=travis:phpunit
# - WP_VERSION=4.9 BP_TRAVISCI=travis:phpunit
# - WP_VERSION=4.8 BP_TRAVISCI=travis:phpunit
# - WP_VERSION=4.7 BP_TRAVISCI=travis:phpunit
env:
- WP_VERSION=master BP_TRAVISCI=travis:grunt
# - WP_VERSION=5.2 BP_TRAVISCI=travis:grunt
# - WP_VERSION=5.1 BP_TRAVISCI=travis:grunt
# - WP_VERSION=5.0 BP_TRAVISCI=travis:grunt
# - WP_VERSION=4.9 BP_TRAVISCI=travis:grunt
# - WP_VERSION=4.8 BP_TRAVISCI=travis:grunt
# - WP_VERSION=4.7 BP_TRAVISCI=travis:grunt
matrix:
include:
- php: 7.3
env: WP_VERSION=master BP_TRAVISCI=travis:grunt
#env: WP_VERSION=master BP_TRAVISCI=travis:grunt SNIFF=1
# - php: 7.3
# env: WP_VERSION=master BP_TRAVISCI=travis:grunt
# #env: WP_VERSION=master BP_TRAVISCI=travis:phpcompat
# - php: 5.3
# env: WP_VERSION=4.8 BP_TRAVISCI=travis:grunt
# #env: WP_VERSION=4.8 BP_TRAVISCI=travis:phpunit
# dist: precise
# - php: 5.3
# env: WP_VERSION=4.7 BP_TRAVISCI=travis:grunt
# #env: WP_VERSION=4.7 BP_TRAVISCI=travis:phpunit
# dist: precise
# exclude:
# - php: 7.3
# env: WP_VERSION=4.9 BP_TRAVISCI=travis:grunt
# #env: WP_VERSION=4.9 BP_TRAVISCI=travis:phpunit
# - php: 7.3
# env: WP_VERSION=4.8 BP_TRAVISCI=travis:grunt
# #env: WP_VERSION=4.8 BP_TRAVISCI=travis:phpunit
# - php: 7.3
# env: WP_VERSION=4.7 BP_TRAVISCI=travis:grunt
# #env: WP_VERSION=4.7 BP_TRAVISCI=travis:phpunit
# - php: 7.3
# env: WP_VERSION=master BP_TRAVISCI=travis:grunt
#env: WP_VERSION=master BP_TRAVISCI=travis:phpunit
# before_install: Failures in this section will result in build status 'errored'
before_install:
# set up WP install
- export WP_DEVELOP_DIR=/tmp/wordpress/
- mkdir -p $WP_DEVELOP_DIR
- git clone --depth=1 --branch="$WP_VERSION" git://develop.git.wordpress.org/ $WP_DEVELOP_DIR
- plugin_slug=$(basename $(pwd))
- plugin_dir=$WP_DEVELOP_DIR/src/wp-content/plugins/$plugin_slug
- cd ..
- mv $plugin_slug $plugin_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
fi
# set up phpcs
- if [[ "$SNIFF" == "1" ]]; then export PHPCS_DIR=/tmp/phpcs; fi
- if [[ "$SNIFF" == "1" ]]; then export SNIFFS_DIR=/tmp/sniffs; fi
# Install PHP_CodeSniffer.
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi
# Install WordPress Coding Standards.
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/WordPress/WordPress-Coding-Standards.git $SNIFFS_DIR; fi
# Set install path for WordPress Coding Standards.
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs --config-set installed_paths $SNIFFS_DIR; fi
# After CodeSniffer install you should refresh your path.
- if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi
# set up tests config
- cd $WP_DEVELOP_DIR
- echo $WP_DEVELOP_DIR
- cp wp-tests-config-sample.php wp-tests-config.php
- sed -i "s/youremptytestdbnamehere/wordpress_test/" wp-tests-config.php
- sed -i "s/yourusernamehere/root/" wp-tests-config.php
- sed -i "s/yourpasswordhere//" wp-tests-config.php
# set up database
- mysql -e 'CREATE DATABASE wordpress_test;' -uroot
# prepare for running the tests
- cd $plugin_dir
# setup NodeJS version using NVM
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- node --version
- nvm install 14
- node --version
- npm install -g grunt-cli
- npm --version
- mysql --version
- phpenv versions
- php --version
- php -m
- phpunit --version
- curl --version
- grunt --version
- git --version
- svn --version
# before_script: Failures in this section will result in build status 'errored'
before_script:
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs -p . --standard=WordPress --ignore=*/vendor/* src/; fi
# - if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.3" ]]; then composer global require --dev phpunit/phpunit ^4; fi
# - if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.6" ]]; then composer global require --dev phpunit/phpunit ^5; composer install; fi
# - if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.2" ]]; then composer global require --dev phpunit/phpunit ^6; composer install; fi
# - if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.3" ]]; then composer global require --dev phpunit/phpunit ^6; composer install; fi
- mkdir -p /tmp/node/node_modules
- ln -s /tmp/node/node_modules $plugin_dir/node_modules
- npm install
- npm rebuild node-sass
# Run tests
script: grunt $BP_TRAVISCI
notifications:
email: false