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

Valid version range syntax breaks CI pipelines #94

Closed
2 tasks done
phptek opened this issue Jun 20, 2024 · 3 comments
Closed
2 tasks done

Valid version range syntax breaks CI pipelines #94

phptek opened this issue Jun 20, 2024 · 3 comments

Comments

@phptek
Copy link

phptek commented Jun 20, 2024

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

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)

PRs

@maxime-rainville
Copy link
Contributor

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
Copy link
Author

phptek commented Jun 23, 2024

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 😀

@GuySartorelli
Copy link
Member

PR merged and new release tagged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants