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

CI: various updates #705

Merged
merged 5 commits into from
Dec 24, 2021
Merged

CI: various updates #705

merged 5 commits into from
Dec 24, 2021

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Dec 23, 2021

Composer: allow the PHPCS plugin

The dealerdirect/phpcodesniffer-composer-installer Composer plugin is used to register external PHPCS standards with PHPCS.

As of Composer 2.2.0, Composer plugins need to be explicitly allowed to run. This adds the necessary configuration for that.

Refs:

GH Actions: use error_reporting=-1

... for bridging differences in E_ALL across PHP versions.

GH Actions: auto-cancel previous builds for same branch

Previously, in Travis, when the same branch was pushed again and the "Auto cancellation" option on the "Settings" page had been turned on (as it was for most repos), any still running builds for the same branch would be stopped in favour of starting the build for the newly pushed version of the branch.

To enable this behaviour in GH Actions, a concurrency configuration needs to be added to each workflow for which this should applied to.

More than anything, this is a way to be kind to GitHub by not wasting resources which they so kindly provide to us for free.

Refs:

GH Actions: update for the release of PHP 8.1

PHP latest from SetupPHP is now PHP 8.1 and the earliest PHPCS version which is (runtime) compatible with PHP 8.1 is PHPCS 3.6.1.

This commit makes the necessary adjustments to the test matrix in both the quicktest and the test workflows to account for that.

Notes:

  • Includes minor simplification of the "lint" matrix and continue-on-error setting.
  • Linting against PHP 8.2 has been turned on (allowed to fail), testing against PHP 8.2 is still disabled for now as it's still quite far away.
  • As the tests are based on the PHPCS native test framework and this framework still limits the PHPUnit versions to PHPUnit 4.x - 7.x, some tweaks are needed to get the tests running on PHP 8.1 as the reading of the PHPUnit configuration file by PHPUnit would yield a fatal error otherwise.
  • The latest release of WPCS throws a few PHP deprecation notices on PHP 8.1. These have been fixed upstream already and the fixes will be included in WPCS 3.0.0.
    Until WPCS 3.0.0 has been released though, we'll need to ignore deprecation notices on PHP 8.1 as otherwise the ruleset test would fail on the notices coming from WPCS.

🆕 GH Actions: version update for ramsey/composer-install

The action used to install Composer packages and handle the caching has released a new major (and some follow-up patch releases), which means, the action reference needs to be updated to benefit from it.

Includes adding --no-interaction to "plain" Composer commands to potentially prevent CI hanging if, for whatever reason, interaction would be needed in the future.

Refs:

The `dealerdirect/phpcodesniffer-composer-installer` Composer plugin is used to register external PHPCS standards with PHPCS.

As of Composer 2.2.0, Composer plugins need to be explicitly allowed to run. This adds the necessary configuration for that.

Refs:
* https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution
... for bridging differences in `E_ALL` across PHP versions.
Previously, in Travis, when the same branch was pushed again and the "Auto cancellation" option on the "Settings" page had been turned on (as it was for most repos), any still running builds for the same branch would be stopped in favour of starting the build for the newly pushed version of the branch.

To enable this behaviour in GH Actions, a `concurrency` configuration needs to be added to each workflow for which this should applied to.

More than anything, this is a way to be kind to GitHub by not wasting resources which they so kindly provide to us for free.

Refs:
* https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/
* https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency
PHP `latest` from SetupPHP is now PHP 8.1 and the earliest PHPCS version which is (runtime) compatible with PHP 8.1 is PHPCS 3.6.1.

This commit makes the necessary adjustments to the test matrix in both the `quicktest` and the `test` workflows to account for that.

Notes:
* Includes minor simplification of the "lint" matrix and `continue-on-error` setting.
* Linting against PHP 8.2 has been turned on (allowed to fail), testing against PHP 8.2 is still disabled for now as it's still quite far away.
* As the tests are based on the PHPCS native test framework and this framework still limits the PHPUnit versions to PHPUnit 4.x - 7.x, some tweaks are needed to get the tests running on PHP 8.1 as the reading of the PHPUnit configuration file by PHPUnit would yield a fatal error otherwise.
* The latest release of WPCS throws a few PHP deprecation notices on PHP 8.1. These have been fixed upstream already and the fixes will be included in WPCS 3.0.0.
    Until WPCS 3.0.0 has been released though, we'll need to ignore deprecation notices on PHP 8.1 as otherwise the ruleset test would fail on the notices coming from WPCS.
@jrfnl jrfnl added this to the 2.3.4 milestone Dec 23, 2021
@jrfnl jrfnl requested a review from a team as a code owner December 23, 2021 03:21
The action used to install Composer packages and handle the caching has released a new major (and some follow-up patch releases), which means, the action reference needs to be updated to benefit from it.

Includes adding `--no-interaction` to "plain" Composer commands to potentially prevent CI hanging if, for whatever reason, interaction would be needed in the future.

Refs:
* https://github.com/ramsey/composer-install/releases/tag/2.0.0
* https://github.com/ramsey/composer-install/releases/tag/2.0.1
* https://github.com/ramsey/composer-install/releases/tag/2.0.2
@jrfnl
Copy link
Collaborator Author

jrfnl commented Dec 24, 2021

I've added a new commit to this PR after releases of the composer-install action today.

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.

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