forked from wp-graphql/wp-graphql-woocommerce
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
101 lines (91 loc) · 2.61 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
sudo: false
dist: trusty
language: php
notifications:
email:
on_success: never
on_failure: never
branches:
only:
- develop
- release-v0.1.0
cache:
apt: true
directories:
- vendor
- $HOME/.composer/cache
# Set the global environment variables
env:
global:
- WP_CORE_DIR: /tmp/wordpress
- COVERAGE: false
- DEBUG: false
matrix:
include:
- php: 7.2
env: WP_VERSION=latest COVERAGE=1
- php: 7.2
env: PHPCS=1
- php: 7.1
env: WP_VERSION=latest
- php: 7.0
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=4.5
- php: 5.6
env: WP_VERSION=latest DEBUG=1
- php: 5.6
env: WP_VERSION=trunk
install:
- |
cd $TRAVIS_BUILD_DIR
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
before_script:
- |
if [ ! -z "$WP_VERSION" ]; then
# Install and config Codeception
cp tests/acceptance.suite.dist.yml tests/acceptance.suite.yml
cp tests/functional.suite.dist.yml tests/functional.suite.yml
cp tests/unit.suite.dist.yml tests/unit.suite.yml
cp tests/wpunit.suite.dist.yml tests/wpunit.suite.yml
cp .env.dist .env
composer install-wp-tests
if [ "$COVERAGE" == "1" ]; then
# Install Coveralls
mkdir -p build/logs
COMPOSER_MEMORY_LIMIT=-1 travis_retry composer require php-coveralls/php-coveralls
fi
COMPOSER_MEMORY_LIMIT=-1 travis_retry composer update --prefer-source --no-interaction
ls -al
fi
# Install PHP CodeSniffer and WPCS.
- |
if [ "$PHPCS" == "1" ]; then
COMPOSER_MEMORY_LIMIT=-1 travis_retry composer require squizlabs/php_codesniffer phpcompatibility/phpcompatibility-wp wp-coding-standards/wpcs dealerdirect/phpcodesniffer-composer-installer
COMPOSER_MEMORY_LIMIT=-1 travis_retry composer install --no-dev
ls -al
fi
script:
# Execute unit tests with coverage if specified, otherwise without coverage
- |
if [ ! -z "$WP_VERSION" ]; then
if [ "$COVERAGE" == "1" ]; then
vendor/bin/codecept run wpunit --coverage --coverage-xml
elif [ "$DEBUG" == "1" ]; then
vendor/bin/codecept run wpunit --debug
else
vendor/bin/codecept run wpunit
fi
fi
- |
if [ "$PHPCS" == "1" ]; then
vendor/bin/phpcs wp-graphql-woocommerce.php access-functions.php class-inflect.php includes/*.php --standard=WordPress
fi
after_success:
# Runs Coveralls.io client
- |
if [ "$COVERAGE" == "1" ]; then
travis_retry php vendor/bin/php-coveralls -v
fi