Skip to content

Commit 931294f

Browse files
author
Felix Arntz
committed
Run additional NPM tests conditionally on Travis.
1 parent 33a6b16 commit 931294f

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

.travis.yml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ cache:
99
php:
1010
- 5.4
1111
- 5.5
12-
- 5.6
1312
- 7.0
1413
- 7.1
1514
env:
@@ -34,6 +33,10 @@ matrix:
3433
env: WP_VERSION=4.9 WP_MULTISITE=1
3534
- php: 5.6
3635
env: WP_VERSION=4.5 WP_MULTISITE=1
36+
- php: 5.6
37+
env: WP_VERSION=4.9 NPM_TESTS=1
38+
- php: 5.6
39+
env: WP_VERSION=4.5 NPM_TESTS=1
3740
allow_failures:
3841
- php: 5.2
3942

@@ -45,19 +48,6 @@ before_script:
4548
phpenv config-rm xdebug.ini
4649
fi
4750
fi
48-
- PLUGIN_SLUG=$(basename $(pwd))
49-
- export WP_DEVELOP_DIR=/tmp/wordpress/
50-
- git clone --depth=50 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress
51-
- cd ..
52-
- cp -r "$PLUGIN_SLUG" "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG"
53-
- cd /tmp/wordpress/
54-
- cp wp-tests-config-sample.php wp-tests-config.php
55-
- sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
56-
- sed -i "s/yourusernamehere/travis/" wp-tests-config.php
57-
- sed -i "s/yourpasswordhere//" wp-tests-config.php
58-
- mysql -e "CREATE DATABASE wordpress_tests;" -uroot
59-
- cd "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG"
60-
- phpenv rehash
6151
- |
6252
case "$TRAVIS_PHP_VERSION" in
6353
5.6|5.5|5.4|5.3)
@@ -74,16 +64,31 @@ before_script:
7464
- cd php52
7565
- composer install
7666
- cd ..
67+
- PLUGIN_SLUG=$(basename $(pwd))
68+
- export WP_DEVELOP_DIR=/tmp/wordpress/
69+
- git clone --depth=50 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress
70+
- cd ..
71+
- cp -r "$PLUGIN_SLUG" "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG"
72+
- cd /tmp/wordpress/
73+
- cp wp-tests-config-sample.php wp-tests-config.php
74+
- sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
75+
- sed -i "s/yourusernamehere/travis/" wp-tests-config.php
76+
- sed -i "s/yourpasswordhere//" wp-tests-config.php
77+
- mysql -e "CREATE DATABASE wordpress_tests;" -uroot
78+
- cd "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG"
79+
- phpenv rehash
7780
- |
78-
rm -rf ~/.nvm
79-
git clone https://github.com/creationix/nvm.git ~/.nvm
80-
cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
81-
source ~/.nvm/nvm.sh
82-
nvm install 8
83-
- npm install
81+
if [[ "$NPM_TESTS" == "1" ]]; then
82+
rm -rf ~/.nvm
83+
git clone https://github.com/creationix/nvm.git ~/.nvm
84+
cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
85+
source ~/.nvm/nvm.sh
86+
nvm install 8
87+
npm install
88+
fi
8489
script:
8590
- phpunit -c phpunit.xml
8691
- |
87-
if [[ "$TRAVIS_PHP_VERSION" != "5.2" ]]; then
92+
if [[ "$NPM_TESTS" == "1" ]]; then
8893
npm test
8994
fi

0 commit comments

Comments
 (0)