Skip to content

Commit

Permalink
Tests: Drop Travis matrix in favor or stages
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Oct 26, 2017
1 parent a55eccc commit 26039fe
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 39 deletions.
63 changes: 24 additions & 39 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,6 @@ before_install:
- nvm install 6.11.1 && nvm use 6.11.1
- npm install --global npm@5

matrix:
include:
- php: 7.1
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=latest
- php: 7.1
env: WP_VERSION=latest SWITCH_TO_PHP=5.3
- php: 7.1
env: WP_VERSION=latest SWITCH_TO_PHP=5.2

script:
- |
export PATH="$HOME/.composer/vendor/bin:$PATH"
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
source bin/install-php-phpunit.sh
# Run the build because otherwise there will be a bunch of warnings about
# failed `stat` calls from `filemtime()`.
npm install || exit 1
npm run build || exit 1
# Make sure phpegjs parser is up to date
node bin/create-php-parser.js || exit 1
if ! git diff --quiet --exit-code lib/parser.php; then
echo 'ERROR: The PEG parser has been updated, but the generated PHP version'
echo ' (lib/parser.php) has not. Run `bin/create-php-parser.js` and'
echo ' commit the resulting changes to resolve this.'
sleep .2 # Otherwise Travis doesn't want to print the whole message
exit 1
fi
echo Running with the following versions:
php -v
phpunit --version
# Check parser syntax
php lib/parser.php || exit 1
# Run PHPUnit tests
phpunit || exit 1
WP_MULTISITE=1 phpunit || exit 1
jobs:
include:
- stage: lint
Expand All @@ -72,10 +34,33 @@ jobs:
- npm install || exit 1
- npm run ci || exit 1

- stage: unit
php: 7.1
env: WP_VERSION=latest
script:
- ./bin/run-wp-unit-tests.sh

- stage: unit
php: 5.6
env: WP_VERSION=latest
script:
- ./bin/run-wp-unit-tests.sh

- stage: unit
php: 7.1
env: WP_VERSION=latest SWITCH_TO_PHP=5.3
script:
- ./bin/run-wp-unit-tests.sh

- stage: unit
php: 7.1
env: WP_VERSION=latest SWITCH_TO_PHP=5.2
script:
- ./bin/run-wp-unit-tests.sh

stages:
- lint
- unit
- test

before_deploy:
- npm install
Expand Down
28 changes: 28 additions & 0 deletions bin/run-wp-unit-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

cd "$(dirname "$0")/../"

export PATH="$HOME/.composer/vendor/bin:$PATH"
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
source bin/install-php-phpunit.sh
# Run the build because otherwise there will be a bunch of warnings about
# failed `stat` calls from `filemtime()`.
npm install || exit 1
npm run build || exit 1
# Make sure phpegjs parser is up to date
node bin/create-php-parser.js || exit 1
if ! git diff --quiet --exit-code lib/parser.php; then
echo 'ERROR: The PEG parser has been updated, but the generated PHP version'
echo ' (lib/parser.php) has not. Run `bin/create-php-parser.js` and'
echo ' commit the resulting changes to resolve this.'
sleep .2 # Otherwise Travis doesn't want to print the whole message
exit 1
fi
echo Running with the following versions:
php -v
phpunit --version
# Check parser syntax
php lib/parser.php || exit 1
# Run PHPUnit tests
phpunit || exit 1
WP_MULTISITE=1 phpunit || exit 1

0 comments on commit 26039fe

Please sign in to comment.