Skip to content

Commit

Permalink
Merge pull request #264 from Yoast/JRF/CI/use-parallel-lint
Browse files Browse the repository at this point in the history
Travis/Composer: switch over to parallel linting of PHP files
  • Loading branch information
Joost de Valk authored Jul 7, 2020
2 parents 5742a3b + f1fd480 commit e34c0b5
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 5 deletions.
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ before_install:
- if [[ "$CHECKJS" == "1" ]]; then export PATH=$HOME/.yarn/bin:$PATH; fi

install:
- if [[ "$PHPUNIT" == "1" ]]; then composer install --no-interaction; fi
- |
if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then
composer install --prefer-dist --no-interaction --ignore-platform-reqs
else
composer install --prefer-dist --no-interaction
fi
- if [[ "$CHECKJS" == "1" ]]; then yarn global add grunt-cli; fi
- if [[ "$CHECKJS" == "1" ]]; then yarn install; fi
- if [[ "$SECURITY" == "1" ]]; then wget -P $SECURITYCHECK_DIR https://get.sensiolabs.org/security-checker.phar && chmod +x $SECURITYCHECK_DIR/security-checker.phar;fi

script:
- if find -L . -path ./vendor -prune -o -path ./node_modules -prune -o -name '*.php' -exec php -l {} \; | grep "^[Parse error|Fatal error]"; then exit 1; fi
# Run PHPCS separately for the plugin files and the test files.
- composer lint
- if [[ "$PHPCS" == "1" ]]; then composer check-cs; fi
- if [[ "$CHECKJS" == "1" ]]; then grunt check; fi
- if [[ "$PHPUNIT" == "1" ]]; then composer test; fi
Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
"require-dev": {
"brain/monkey": "^2.4.0",
"phpunit/phpunit": "^5.4 || ^6.0 || ^7.0",
"yoast/yoastcs": "^2.0.0"
"yoast/yoastcs": "^2.0.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"php-parallel-lint/php-console-highlighter": "^0.5"
},
"autoload": {
"classmap": [ "inc" ]
Expand All @@ -68,6 +70,9 @@
}
},
"scripts": {
"lint": [
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --exclude vendor --exclude node_modules --exclude .git"
],
"test": [
"@php ./vendor/phpunit/phpunit/phpunit --colors=always"
],
Expand Down
149 changes: 148 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e34c0b5

Please sign in to comment.