-
Notifications
You must be signed in to change notification settings - Fork 29
/
.travis.yml
60 lines (53 loc) · 2.25 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
# 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
# Versions of PHP to test against - PHPCompatibilityWP does linting for earlier versions.
php:
- 7.2
# 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=5.0 WP_MULTISITE=0 BP_VERSION=master
# Grab the setup script and execute
before_script:
- 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 admin/ by-email/ functions.php group-invites/ invite-anyone.php lib/ tests/ widgets/ --standard=PHPCompatibilityWP --runtime-set testVersion 5.3- --extensions=php
- ./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: