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: Add concurrency to CI configs, and Composer tweaks #559

Merged
merged 4 commits into from
Dec 24, 2021

Conversation

GaryJones
Copy link
Contributor

Description

Add concurrency to CI configs

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.

Composer tweaks

  • ramsay/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.
  • Add --no-interaction to "plain" Composer commands to potentially prevent CI hanging if, for whatever reason, interaction would be needed in the future.

Composer: permit composer plugins

The dealerdirect/phpcodesniffer-composer-installer and composer/installers Composer plugins are used to register an external PHPCS standards with PHPCS, and allow the plugin to be installed in a wp-content/plugins directory.

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

Any globally-installed Composer plugin should be configured in the global composer.json.

composer normalize also run on the file, which fixes a non-alphabetical script.

Also, refreshes the list of script descriptions.

Refs:

Motivation and Context

All kudos to @jrfnl - 95% of this PR is her original work and words from Automattic/VIP-Coding-Standards#705 🙏🏻

If I have seen further it is by standing on the shoulders of giants.
Sir Isaac Newton

How Has This Been Tested?

The CI jobs for this PR all pass.

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.
- `ramsay/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.
- Add `--no-interaction` to "plain" Composer commands to potentially prevent CI hanging if, for whatever reason, interaction would be needed in the future.
The `dealerdirect/phpcodesniffer-composer-installer` and `composer/installers` Composer plugins are used to register an external PHPCS standards with PHPCS, and allow the plugin to be installed in a `wp-content/plugins` directory.

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

Any globally-installed Composer plugin should be configured in the global `composer.json`.

`composer normalize` also run on the file, which fixes a non-alphabetical script.

Also refresh the list of script descriptions.

Refs:

https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution
@GaryJones GaryJones added this to the 3.1.0 milestone Dec 24, 2021
@GaryJones GaryJones self-assigned this Dec 24, 2021
@GaryJones GaryJones requested a review from a team as a code owner December 24, 2021 10:36
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@GaryJones GaryJones merged commit 501a7e5 into develop Dec 24, 2021
@GaryJones GaryJones deleted the fix/ci-improvements branch December 24, 2021 13:38
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