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 authored and youknowriad committed May 10, 2017
1 parent d5cf3d8 commit 7cade42
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 7cade42

Please sign in to comment.