Skip to content

Commit af8764f

Browse files
committed
.travis.yml script rewritten.
1 parent 8c653ad commit af8764f

File tree

2 files changed

+66
-32
lines changed

2 files changed

+66
-32
lines changed

.travis.yml

Lines changed: 61 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,82 @@
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+
- php: 5.6
33+
env: WP_VERSION=4.9
34+
- php: 5.6
35+
env: WP_VERSION=latest
36+
- php: 5.6
37+
env: WP_TRAVISCI=phpcs
2238

23-
# Composer package installation
2439
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
40+
- |
41+
cd $TRAVIS_BUILD_DIR
42+
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
43+
chmod +x wp-cli.phar
44+
sudo mv wp-cli.phar /usr/local/bin/wp
3445
3546
before_script:
36-
- bash bin/install-wp-tests.sh
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
47+
- export PATH="$HOME/.composer/vendor/bin:$PATH"
48+
- |
49+
if [[ ! -z "$WP_VERSION" ]]; then
50+
cp .env.dist .env
51+
composer install-wp-tests
52+
COMPOSER_MEMORY_LIMIT=-1 travis_retry composer install --prefer-source --no-interaction
53+
fi
54+
- |
55+
if [[ "$WP_TRAVISCI" == "phpcs" ]]; then
56+
COMPOSER_MEMORY_LIMIT=-1 travis_retry composer require \
57+
squizlabs/php_codesniffer \
58+
phpcompatibility/phpcompatibility-wp wp-coding-standards/wpcs \
59+
dealerdirect/phpcodesniffer-composer-installer
60+
COMPOSER_MEMORY_LIMIT=-1 travis_retry composer install --no-dev
61+
fi
4262
4363
script:
44-
- vendor/bin/codecept run wpunit
45-
64+
- |
65+
if [[ ! -z "$WP_VERSION" ]]; then
66+
vendor/bin/codecept run wpunit
67+
fi
68+
- |
69+
if [[ "$WP_TRAVISCI" == "phpcs" ]]; then
70+
vendor/bin/phpcs \
71+
wp-graphql-acf.php \
72+
src/*.php --standard=WordPress
73+
fi
4674
after_success:
47-
# - travis_retry php coveralls.phar -v
75+
# Download and run Coveralls.io client
76+
- |
77+
if [ "$COVERAGE" == "1" ]; then
78+
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
79+
chmod +x php-coveralls.phar
4880
49-
cache:
50-
directories:
51-
- $HOME/.composer/cache
81+
travis_retry php php-coveralls.phar -v
82+
fi

bin/install-wp-tests.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
source .env.dist
3+
source .env
44

55
print_usage_instruction() {
66
echo "Ensure that .env file exist in project root directory exists."
@@ -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() {

0 commit comments

Comments
 (0)