Skip to content

Commit

Permalink
Apply Travis CI improvements from #676:
Browse files Browse the repository at this point in the history
- Do the client-side build before running PHPUnit tests; this ensures
  that the plugin doesn't try to enqueue non-existent JS files and cause
  a bunch of warnings
- If a step in the build fails, go ahead and exit
- Don't scan node_modules/ and vendor/ for PHP files
- Run phpcs with the `-s` option (show rule identifiers in reports)
- Don't require docblocks for unit tests
  • Loading branch information
nylen committed May 5, 2017
1 parent 96d6b3b commit 47e81bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
16 changes: 11 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,21 @@ before_script:
script:
- |
if [[ ! -z "$WP_VERSION" ]] ; then
phpunit
WP_MULTISITE=1 phpunit
npm install || exit 1
npm run build || exit 1
phpunit || exit 1
WP_MULTISITE=1 phpunit || exit 1
fi
- |
if [[ "$TRAVISCI" == "phpcs" ]] ; then
phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
find . \
-not \( -path './node_modules' \) \
-not \( -path './vendor' \) \
-name '*.php' \
| xargs -d'\n' phpcs --standard=phpcs.ruleset.xml -s
fi
- |
if [[ "$TRAVISCI" == "js" ]] ; then
npm install
npm run ci
npm install || exit 1
npm run ci || exit 1
fi
6 changes: 4 additions & 2 deletions phpcs.ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<rule ref="WordPress-Core" />
<rule ref="WordPress-Docs" />

<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- Do not require docblocks for unit tests -->
<rule ref="Squiz.Commenting.FunctionComment.Missing">
<exclude-pattern>phpunit/*</exclude-pattern>
</rule>
</ruleset>

0 comments on commit 47e81bd

Please sign in to comment.