Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH Actions: switch over to parallel linting of PHP files #653

Merged
merged 1 commit into from
Apr 15, 2021

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Apr 15, 2021

Composer

This installs two additional PHP packages in require-dev:

  • php-parallel-lint which allows for linting PHP files in parallel (faster), as well as automatically recursively walking directories.
  • php-console-highlighter which provides PHP code highlighting in the command line console, allowing the linter to display the results in a more meaningful manner.

It also adjusts the existing bin/php-lint script to use this new dependency instead of using *nix specific commands.

GH Actions

As it was, PHP linting was only done on PHP 7.4 as part of the basics workflow.

This commit changes this to run linting on the lowest (PHP 5.4) and highest (latest/PHP 8.0) supported PHP versions as part of the test workflow. (And by "supported", I mean runtime support in this case, not syntax support.)

The running of the tests has been made dependent on the linting jobs passing as if the linting turns up failures, we can be sure that there will be (or should be) failures in the test runs anyway.

This new job uses the "CS2PR" tool which will show any errors as feedback in the actual PR code view.

It also runs the linter against PHP 8.1 - against which we are currently not yet running the tests - as an early warning system in case of upcoming issues.

Ref:

Related to #628

### Composer

This installs two additional PHP packages in `require-dev`:
* [`php-parallel-lint`](https://packagist.org/packages/php-parallel-lint/php-parallel-lint) which allows for linting PHP files in parallel (faster), as well as automatically recursively walking directories.
* [`php-console-highlighter`](https://packagist.org/packages/php-parallel-lint/php-console-highlighter) which provides PHP code highlighting in the command line console, allowing the linter to display the results in a more meaningful manner.

It also adjusts the existing `bin/php-lint` script to use this new dependency instead of using *nix specific commands.

### GH Actions

As it was, PHP linting was only done on PHP 7.4 as part of the `basics` workflow.

This commit changes this to run linting on the lowest (PHP 5.4) and highest (latest/PHP 8.0) supported PHP versions as part of the `test` workflow. (And by "supported", I mean _runtime_ support in this case, not _syntax support_.)

The running of the tests has been made dependent on the linting jobs passing as if the linting turns up failures, we can be sure that there will be (or should be) failures in the test runs anyway.

This new job uses the "CS2PR" tool which will show any errors as feedback in the actual PR code view.

It also runs the linter against PHP 8.1 - against which we are currently not yet running the tests - as an early warning system in case of upcoming issues.

Ref:
* https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/tag/v1.3.0
* https://github.com/php-parallel-lint/PHP-Console-Highlighter/releases/tag/v0.5
@jrfnl jrfnl added this to the 2.3.0 milestone Apr 15, 2021
@jrfnl jrfnl requested a review from a team as a code owner April 15, 2021 02:21
@rebeccahum rebeccahum merged commit 1af6b37 into develop Apr 15, 2021
@rebeccahum rebeccahum deleted the fix/ghactions-improve-php-linting branch April 15, 2021 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants