PHPCSStandards / composer-installer

Composer installer for PHP_CodeSniffer coding standards
https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer
MIT License
542 stars 36 forks source link

CI: investigate auto-triggering a test run on release of a new Composer/PHPCS version #197

Open jrfnl opened 1 year ago

jrfnl commented 1 year ago

For Composer releases, I've been manually triggering a test build on each release. Would be nice if we could automate this.

For PHPCS releases, tests/PHPCSVersions.php class needs to be updated on a new release. Again, would be nice if we could automate this.

I'm not sure how to trigger a workflow on the release of another package, but if there is no predefined way to do so, we could possibly do this by:

  1. Having a dev file committed in the repo with the version nr of the "last seen release" of each package.
  2. Running a workflow via a daily cron job which would compare the "last release" from the packages against the stored "last seen release" and would trigger the test/test update workflows if the versions are not the same.
Potherca commented 1 year ago

I'm not sure how to trigger a workflow on the release of another package

As far as I'm aware there is no such feature, unless you are the owner of both repos. The most sane approach would seem to be periodically checking for new releases by using on.schedule.cron

jrfnl commented 1 year ago

Sounds like we're on the same track ;-)

Potherca commented 2 months ago

Since opening this issue, both PHP_CodeSniffer and this project live under the same organization, so it should now be possible to trigger a build of the one from the other.

I'd have to look back into my bag of tricks, but from the top of my head, I think it was the repository_dispatch trigger that could be used.

See also community:discussions/26323#6749966

jrfnl commented 2 months ago

Since opening this issue, both PHP_CodeSniffer and this project live under the same organization, so it should now be possible to trigger a build of the one from the other.

I'd have to look back into my bag of tricks, but from the top of my head, I think it was the repository_dispatch trigger that could be used.

See also community:discussions/26323#6749966

... that reminds me... - see #222 ;-)

In one of the other projects, I currently run with a cron job to update the PHPCS version in a test file and automatically open an PR for the update. That's a workflow from before PHPCS itself moved into this organisation though, so I might be able to update it to use the trigger you mentioned.

Having said that, I can imagine that workflow could serve as inspiration for what we need here for the PHPCS side of things (step-wise).

Still wouldn't solve the issue of re-running the tests on new Composer releases.