-
Notifications
You must be signed in to change notification settings - Fork 44
/
.travis.yml
72 lines (64 loc) · 2.7 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
# Main Travis CI configuration file for wordpress-plugin tests
# https://github.com/benbalter/wordpress-plugin-tests
# Tell Travis CI we're using PHP
language: php
services:
- mysql
# Versions of PHP to test against
php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
# Specify versions of WordPress to test against
# WP_VERSION = WordPress version number (use "master" for SVN trunk)
# WP_MULTISITE = whether to test multisite (use either "0" or "1")
# Note: Testing only against BP master for now (ignore old versions because of
# changes in the path structure)
env:
- WP_VERSION=master WP_MULTISITE=0 BP_VERSION=master
- WP_VERSION=master WP_MULTISITE=1 BP_VERSION=master
# Grab the setup script and execute
before_script:
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.6" ]]; then composer require --dev phpunit/phpunit ^5; fi
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]]; then composer require --dev phpunit/phpunit ^6; fi
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.1" ]]; then composer require --dev phpunit/phpunit ^6; fi
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.2" ]]; then composer require --dev phpunit/phpunit ^6; fi
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.3" ]]; then composer require --dev phpunit/phpunit ^6; fi
- export WP_DEVELOP_DIR=/tmp/wordpress-develop/
- git clone git://develop.git.wordpress.org/trunk/ $WP_DEVELOP_DIR
- plugin_slug=$(basename $(pwd))
- plugin_dir=$WP_DEVELOP_DIR/src/wp-content/plugins/$plugin_slug
- cd ..
- mv $plugin_slug $plugin_dir
# set up BuddyPress
- buddypress_dir=$WP_DEVELOP_DIR/src/wp-content/plugins/buddypress
- mkdir -p $buddypress_dir
- wget -nv -O /tmp/buddypress.tar.gz https://github.com/BuddyPress/BuddyPress/tarball/$BP_VERSION
- tar --strip-components=1 -zxmf /tmp/buddypress.tar.gz -C $buddypress_dir
# set up testing suite
- cd $WP_DEVELOP_DIR
- cp wp-tests-config-sample.php wp-tests-config.php
- sed -i "s:dirname( __FILE__ ) . '/wordpress/':'$WP_CORE_DIR':" 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
- pwd
- composer install
script:
- ./vendor/bin/phpcs -p bp-docs.php includes loader.php --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 5.3-
- ./vendor/bin/phpunit
# wordpress-plugin-tests specific config
# Tells Travis CI not to run unit tests against the setup branch
branches:
except:
- setup
notifications:
email:
recipients: