silverstripe / gha-generate-matrix

GitHub Action - CI matrix generator
BSD 3-Clause "New" or "Revised" License
1 stars 5 forks source link

Valid version range syntax breaks CI pipelines #94

Open phptek opened 1 week ago

phptek commented 1 week ago

Module version(s) affected

v1

Description

The use of valid Composer php version range syntax, breaks CI runs. Worse, the error message is worse than useless!

How to reproduce

  1. Add a ci.yml workflow to any Silverstripe module project following an example taken from e.g. silverstripe/framework
  2. Your Silverstripe module uses the legacy Composer single pipe php version-range syntax (which is still valid)
  3. Observe a CI run break with a braindead error message in the "Generate Matrix" step:
PHP Fatal error:  Uncaught Exception: No valid PHP version allowed in /home/runner/work/_actions/silverstripe/gha-generate-matrix/v1/job_creator.php:283

What on earth does "No valid PHP version allowed" even mean! I think that should be "No valid PHP version found".

Possible Solution

The code here should be patched to permit both syntaxes as follows:

$constraints = preg_split('#(\|\||\|)#', $this->composerPhpConstraint);

Additional Context

No response

Validations

maxime-rainville commented 1 week ago

Does || not work?

Would having having a hard fail with | with a clear error message that you should use || instead be an acceptable solution?

phptek commented 1 week ago

A double pipe works yes, and I fixed my issue using that, but a single pipe is legitimate, valid syntax and should be supported.

Tweaking the error message so that folks can debug quickly, would be a nice accompaniment 😀