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 versions are set #300

Merged
merged 1 commit into from
Apr 30, 2023

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Apr 30, 2023

As things were, whenever the minimum PHPCS or WPCS version would be changed, the branch protection settings for both the main and the develop branch would need to be updated and all "required builds" referencing the old PHPCS/WPCS version would need to be removed, while new "required builds" would need to be added referencing the new minimum PHPCS/WPCS version.

This was a fiddly process and time-consuming.

The change proposed in this commit takes advantage of the Composer --prefer-lowest setting to achieve the same without a hard-coded PHPCS/WPCS version in the build name, which means that once the branch protection settings have been updated for this PR, they shouldn't need updating anymore for future PHPCS/WPCS version bumps.

Notes:

  • Includes a new debug step ("Verify installed versions").
  • The --prefer-lowest command is not run via the ramsey/composer-install action runner, but in a separate step. Running it via ramsey/composer-install would also impact the PHPUnit version, which would break the builds.
  • I'm only making this change in the test.yml workflow, not in the quicktest.yml workflow. - The builds in quicktest are not required, so do not impact the branch protection settings. - This also allows to still test mixed high/low variants (i.e. low PHPCS, high WPCS and visa versa) via the quicktest workflow.

As a side-effect of this PR, the test workflow will now have only half the amount of builds as before.

As things were, whenever the minimum PHPCS or WPCS version would be changed, the branch protection settings for both the `main` and the `develop` branch would need to be updated and all "required builds" referencing the old PHPCS/WPCS version would need to be removed, while new "required builds" would need to be added referencing the new minimum PHPCS/WPCS version.

This was a fiddly process and time-consuming.

The change proposed in this commit takes advantage of the Composer `--prefer-lowest` setting to achieve the same without a hard-coded PHPCS/WPCS version in the build name, which means that once the branch protection settings have been updated for this PR, they shouldn't need updating anymore for future PHPCS/WPCS version bumps.

Notes:
* Includes a new debug step ("Verify installed versions").
* The `--prefer-lowest` command is not run via the `ramsey/composer-install` action runner, but in a separate step. Running it via `ramsey/composer-install` would also impact the PHPUnit version, which would break the builds.
* I'm only making this change in the `test.yml` workflow, not in the `quicktest.yml` workflow.
    - The builds in `quicktest` are not _required_, so do not impact the branch protection settings.
    - This also allows to still test mixed high/low variants (i.e. low PHPCS, high WPCS and visa versa) via the `quicktest` workflow.
@jrfnl jrfnl added this to the Next release milestone Apr 30, 2023
@jrfnl jrfnl merged commit 60e19f6 into develop Apr 30, 2023
@jrfnl jrfnl deleted the JRF/ghactions-use-prefer-lowest branch April 30, 2023 14:23
@jrfnl jrfnl modified the milestones: Next release, 3.0 Sep 17, 2023
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.

1 participant