Skip to content

Commit e6d173e

Browse files
authored
Merge pull request #52 from jasonbahl/feature/#51-travis-calls-wrong-install-command
- Update travis.yml config
2 parents 2f5d0e1 + 48bcf64 commit e6d173e

File tree

6 files changed

+74
-33
lines changed

6 files changed

+74
-33
lines changed

.coveralls.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
service_name: travis-ci
2+
coverage_clover: tests/_output/coverage.xml
3+
json_path: tests/_output/coverage.json

.travis.yml

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,78 @@
1-
language: php
2-
31
sudo: false
2+
dist: trusty
3+
4+
language: php
45

56
notifications:
67
email:
78
on_success: never
8-
on_failure: never
9+
on_failure: change
910

1011
branches:
1112
only:
1213
- master
13-
- develop
14+
15+
cache:
16+
directories:
17+
- vendor
18+
- $HOME/.composer/cache
1419

1520
matrix:
1621
include:
22+
- php: 7.3
23+
env: WP_VERSION=latest
24+
- php: 7.2
25+
env: WP_VERSION=latest
1726
- php: 7.1
18-
env: WP_VERSION=latest WP_MULTISITE=0 PHP_UNIT_VERSION=6.3
19-
- php: 7.1
20-
env: WP_VERSION=latest WP_MULTISITE=1 PHP_UNIT_VERSION=6.3
21-
fast_finish: true
27+
env: WP_VERSION=latest
28+
- php: 7.0
29+
env: WP_VERSION=latest
30+
- php: 7.0
31+
env: WP_VERSION=trunk
32+
allow_failures:
33+
- env: WP_TRAVISCI=phpcs
2234

23-
# Composer package installation
2435
install:
25-
- cd $TRAVIS_BUILD_DIR
26-
# Install WP CLI
27-
- curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
28-
- chmod +x wp-cli.phar
29-
- sudo mv wp-cli.phar /usr/local/bin/wp
30-
# Install coveralls.phar
31-
#- wget -c -nc --retry-connrefused --tries=0 https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
32-
#- chmod +x coveralls.phar
33-
#- php coveralls.phar --version
36+
- |
37+
cd $TRAVIS_BUILD_DIR
38+
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
39+
chmod +x wp-cli.phar
40+
sudo mv wp-cli.phar /usr/local/bin/wp
3441
3542
before_script:
36-
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
37-
- composer self-update
38-
# - composer require phpunit/phpunit:$PHP_UNIT_VERSION
39-
- composer install --no-interaction
40-
- mkdir -p build/logs
41-
- ls -al
43+
- export PATH="$HOME/.composer/vendor/bin:$PATH"
44+
- |
45+
if [[ ! -z "$WP_VERSION" ]]; then
46+
cp .env.dist .env
47+
composer install-wp-tests
48+
COMPOSER_MEMORY_LIMIT=-1 travis_retry composer install --prefer-source --no-interaction
49+
fi
50+
- |
51+
if [[ "$WP_TRAVISCI" == "phpcs" ]]; then
52+
COMPOSER_MEMORY_LIMIT=-1 travis_retry composer require \
53+
squizlabs/php_codesniffer \
54+
phpcompatibility/phpcompatibility-wp wp-coding-standards/wpcs \
55+
dealerdirect/phpcodesniffer-composer-installer
56+
COMPOSER_MEMORY_LIMIT=-1 travis_retry composer install --no-dev
57+
fi
4258
4359
script:
44-
- vendor/bin/codecept run wpunit
45-
60+
- |
61+
if [[ ! -z "$WP_VERSION" ]]; then
62+
vendor/bin/codecept run wpunit
63+
fi
64+
- |
65+
if [[ "$WP_TRAVISCI" == "phpcs" ]]; then
66+
vendor/bin/phpcs \
67+
wp-graphql-acf.php \
68+
src/*.php --standard=WordPress
69+
fi
4670
after_success:
47-
# - travis_retry php coveralls.phar -v
71+
# Download and run Coveralls.io client
72+
- |
73+
if [ "$COVERAGE" == "1" ]; then
74+
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
75+
chmod +x php-coveralls.phar
4876
49-
cache:
50-
directories:
51-
- $HOME/.composer/cache
77+
travis_retry php php-coveralls.phar -v
78+
fi

bin/install-wp-tests.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ install_db() {
142142
fi
143143

144144
# create database
145-
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
145+
RESULT=`mysql -u $DB_USER --password="$DB_PASS" --skip-column-names -e "SHOW DATABASES LIKE '$DB_NAME'"$EXTRA`
146+
if [ "$RESULT" != $DB_NAME ]; then
147+
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
148+
fi
146149
}
147150

148151
configure_wordpress() {

composer.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
"email": "[email protected]"
1111
}
1212
],
13+
"scripts": {
14+
"install-wp-tests": "bash bin/install-wp-tests.sh",
15+
"test": "vendor/bin/codecept run",
16+
"functional-test": "vendor/bin/codecept run functional",
17+
"acceptance-test": "vendor/bin/codecept run acceptance",
18+
"wpunit-test": "vendor/bin/codecept run wpunit"
19+
},
1320
"require": {
1421
"firebase/php-jwt": "^4.0"
1522
},

phpcs.ruleset.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<rule ref="WordPress-Core" />
66
<rule ref="WordPress-Docs" />
77

8-
<exclude-pattern>*/node_modules/*</exclude-pattern>
9-
<exclude-pattern>*/vendor/*</exclude-pattern>
8+
<exclude-pattern>/vendor/</exclude-pattern>
9+
<exclude-pattern>/node_modules/</exclude-pattern>
10+
<exclude-pattern>/tests/</exclude-pattern>
1011
</ruleset>

tests/_data/config.php

Whitespace-only changes.

0 commit comments

Comments
 (0)