forked from Strategy11/formidable-forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
88 lines (83 loc) · 2.91 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
dist: trusty
language: php
sudo: false
matrix:
include:
- php: 7.1
env: WP_VERSION=master WP_MULTISITE=1 SNIFF=1
- php: 7.2
env: WP_VERSION=master WP_MULTISITE=1
- php: 7.0
env: WP_VERSION=master SCRIPT_DEBUG=1
- php: 7.0
env: WP_VERSION=4.9 COVERAGE=1 PHPUNIT=0
- php: 5.6
env: WP_VERSION=4.7
- php: nightly
env: WP_VERSION=master
allow_failures:
- php: nightly
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
- |
# Install the specified version of PHPUnit depending on the PHP version:
case "$TRAVIS_PHP_VERSION" in
7.3|7.2|nightly)
echo "Using PHPUnit 7.x"
travis_retry composer require "phpunit/phpunit:^7"
;;
7.1|7.0)
echo "Using PHPUnit 6.x"
travis_retry composer require "phpunit/phpunit:^6"
;;
5.6)
echo "Using PHPUnit 4.x"
travis_retry composer require "phpunit/phpunit:^4"
;;
*)
echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION"
exit 1
;;
esac
- ./vendor/bin/phpunit --version
- mysql --version
- PLUGIN_SLUG=$(basename $(pwd))
- export WP_DEVELOP_DIR=/tmp/wordpress/
- git clone --depth=50 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress
- cd ..
- cp -r "$PLUGIN_SLUG" "/tmp/wordpress/src/wp-content/plugins/formidable"
- cd /tmp/wordpress/
- cp wp-tests-config-sample.php wp-tests-config.php
- sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
- sed -i "s/yourusernamehere/travis/" wp-tests-config.php
- sed -i "s/yourpasswordhere//" wp-tests-config.php
- mysql -u root -e "CREATE DATABASE wordpress_tests;"
- cd "/tmp/wordpress/src/wp-content/plugins/formidable"
- phpenv rehash
# Install JSHint, a JavaScript Code Quality Tool.
# @link http://jshint.com/docs/
- if [[ "$SNIFF" == "1" ]]; then npm install eslint; fi
# Pull in the WP Core jshint rules.
- if [[ "$SNIFF" == "1" ]]; then wget https://develop.svn.wordpress.org/trunk/.jshintrc; fi
script:
- if [[ "$SCRIPT_DUBUG" == "1" ]]; then php -r "define('SCRIPT_DUBUG', true);"; fi
- if [[ "$SCRIPT_DUBUG" == "0" ]]; then php -r "define('SCRIPT_DUBUG', false);"; fi
# Run the theme through JSHint. Turn on in 3.0
- if [[ "$SNIFF" == "1" ]]; then ./node_modules/.bin/eslint ./js/formidable*; fi
- |
if [ "$PHPUNIT" != "0" ]; then
./vendor/bin/phpunit --group=ajax -c phpunit.xml
./vendor/bin/phpunit --group=entries -c phpunit.xml
./vendor/bin/phpunit --group=styles -c phpunit.xml
./vendor/bin/phpunit --exclude-group=ajax,entries,styles -c phpunit.xml
fi
- if [[ "$COVERAGE" == "1" ]]; then vendor/bin/phpunit --coverage-clover=coverage.xml; fi
after_script:
# upload coverage.xml file to Codecov
- if [[ "$COVERAGE" == "1" ]]; then bash <(curl -s https://codecov.io/bash); fi