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: tweak the way the PHPCS/WPCS versions are set #787

Merged
merged 1 commit into from
Aug 26, 2023

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Aug 25, 2023

VIPCS now doesn't just have PHPCS and WPCS as dependencies for the sniffs and ruleset tests, but also PHPCSUtils, PHPCSExtra and VariableAnalysis and for those last three, the different versions which may be supported are not (yet) taken into account.

Now, it could be argued that every single combination of the different versions of each of these dependencies should be tested, but that would make the matrix huge to little added benefit.

So, instead I'm proposing a slightly different strategy, which should still allow us to verify that things work correctly with enough confidence, while making the workflow maintenance less involved.

The change I'm proposed in this commit takes advantage of the Composer --prefer-lowest option to achieve this.

It basically sets the matrix up to test against a combination of all CS dependencies on their lowest supported version + on their stable/highest supported version.

While at this time, the lowest and the stable versions are the same, this will not always be the case, so having the matrix set up this way allows for new releases of these CS dependencies automatically.

In the original setup, the highest/stable version combi wasn't tested. Instead a combi using the dev version of the dependencies was used. To me, it makes sense to test against the dev versions as well, but I don't believe this needs to be done for the whole range of supported PHP versions. To that end, I've set up four extra jobs against select high/low PHP versions in the test workflow to test against a combination of all CS dependencies on their latest dev version.

Note: I have not added the setup for testing against dev versions to the quicktest workflow.

Also note that the workflows currently contain a toggle for installing the lowest versions with/without ignoring platform requirement. This toggle is needed for PHP 8.x due to the max supported PHPUnit version being PHPUnit 7.x. This toggle can be removed once upstream PR squizlabs/PHP_CodeSniffer#3803 has been merged.

VIPCS now doesn't just have PHPCS and WPCS as dependencies for the sniffs and ruleset tests, but also PHPCSUtils, PHPCSExtra and VariableAnalysis and for those last three, the different versions which may be supported are not (yet) taken into account.

Now, it could be argued that every single combination of the different versions of each of these dependencies should be tested, but that would make the matrix _huge_ to little added benefit.

So, instead I'm proposing a slightly different strategy, which should still allow us to verify that things work correctly with enough confidence, while making the workflow maintenance less involved.

The change I'm proposed in this commit takes advantage of the Composer `--prefer-lowest` option to achieve this.

It basically sets the matrix up to test against a combination of all CS dependencies on their lowest supported version + on their stable/highest supported version.

While at this time, the lowest and the stable versions are the same, this will not always be the case, so having the matrix set up this way allows for new releases of these CS dependencies automatically.

In the original setup, the highest/stable version combi wasn't tested. Instead a combi using the `dev` version of the dependencies was used.
To me, it makes sense to test against the `dev` versions as well, but I don't believe this needs to be done for the whole range of supported PHP versions.
To that end, I've set up four extra jobs against select high/low PHP versions in the `test` workflow to test against a combination of all CS dependencies on their latest `dev` version.

Note: I have not added the setup for testing against `dev` versions to the `quicktest` workflow.

Also note that the workflows currently contain a toggle for installing the `lowest` versions with/without ignoring platform requirement.
This toggle is needed for PHP 8.x due to the max supported PHPUnit version being PHPUnit 7.x.
This toggle can be removed once upstream PR squizlabs/PHP_CodeSniffer 3803 has been merged.
@jrfnl jrfnl added this to the 3.0.0 milestone Aug 25, 2023
@jrfnl jrfnl requested a review from a team as a code owner August 25, 2023 23:14
Copy link
Contributor

@GaryJones GaryJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GaryJones GaryJones merged commit 92a8c82 into develop Aug 26, 2023
36 checks passed
@GaryJones GaryJones deleted the 3.0/feature/ghactions-improve-matrix branch August 26, 2023 00:18
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.

2 participants