-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
97 lines (97 loc) · 3.27 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
sudo: false
language: php
cache:
directories:
- node_modules
- vendor
- $HOME/.composer/cache
matrix:
allow_failures:
- php: hhvm
- env: WP_VERSION=4.9 TORRO_VERSION=master WP_TRAVIS_OBJECT_CACHE=true
include:
- php: 7.2
env: WP_VERSION=master TORRO_VERSION=master WP_MULTISITE=1 PHPLINT=1 PHPCS=1 COVERAGE=1
- php: 5.6
env: WP_VERSION=4.9 TORRO_VERSION=master WP_MULTISITE=1 PHPLINT=1
- php: 7.2
env: WP_VERSION=4.9 TORRO_VERSION=master
- php: 7.2
env: WP_VERSION=4.8 TORRO_VERSION=master
- php: 7.1
env: WP_VERSION=4.9 TORRO_VERSION=master
- php: 7.0
env: WP_VERSION=4.9 TORRO_VERSION=master
- php: 5.6
env: WP_VERSION=4.9 TORRO_VERSION=master
- php: 5.6
env: WP_VERSION=4.9 TORRO_VERSION=master WP_TRAVIS_OBJECT_CACHE=true
services: memcached
- php: hhvm
env: WP_VERSION=4.9 TORRO_VERSION=master
before_install:
- |
if [[ "$WP_TRAVIS_OBJECT_CACHE" == "true" ]]; then
echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
fi
before_script:
- |
if [[ "$COVERAGE" != "1" ]]; then
stable='^[0-9\.]+$'
if [[ "$TRAVIS_PHP_VERSION" =~ $stable ]]; then
phpenv config-rm xdebug.ini
fi
else
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
fi
- composer selfupdate 1.0.0 --no-interaction
- composer install --no-interaction
- npm install &>/dev/null
- 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/$PLUGIN_SLUG"
- cd /tmp/wordpress/
- git clone https://github.com/awsmug/torro-forms.git src/wp-content/plugins/torro-forms --branch "$TORRO_VERSION" --single-branch
- cd src/wp-content/plugins/torro-forms && composer install --no-dev --no-interaction && cd ../../../..
- |
if [[ "$WP_TRAVIS_OBJECT_CACHE" == "true" ]]; then
curl https://raw.githubusercontent.com/tollmanz/wordpress-pecl-memcached-object-cache/584392b56dc4adbe52bd2c7b86f875e23a3e5f75/object-cache.php > src/wp-content/object-cache.php
fi
- 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 -e "CREATE DATABASE wordpress_tests;" -uroot
- cd "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG"
- phpenv rehash
script:
- |
if [[ "$PHPLINT" == "1" ]]; then
find -L . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
fi
- |
if [[ "$PHPCS" == "1" ]]; then
vendor/bin/phpcs -v --runtime-set ignore_warnings_on_exit 1
fi
- |
if [[ -z "$CODECLIMATE_REPO_TOKEN" ]]; then
COVERAGE="0"
fi
- |
if [[ "$COVERAGE" == "1" ]]; then
mkdir -p build/logs
vendor/bin/phpunit -c phpunit.xml --coverage-clover build/logs/clover.xml
else
vendor/bin/phpunit -c phpunit.xml
fi
after_script:
- |
if [[ "$COVERAGE" == "1" ]]; then
./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
fi
notifications:
email: false