Skip to content

feat(semver-compare): add new Github action #146

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

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

damienwebdev
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Currently, we don't have a way to compare semver versions making handling BC issues a challenge.

Touches #132

What is the new behavior?

This adds a new Github Action that semantically compares two versions, like 2.1.1 and 2.3.0 giving information about whether or the version is "higher" or "lower" than another version. The action exposes an output called result which will match the return type of the PHP version_compare function.

Currently, this action compares version against compare_against and returns:

  • -1 - if version is lower than compare_against
  • 0 - if version is equal to compare_against
  • 1 - if version is greater than compare_against

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@damienwebdev damienwebdev requested a review from a team as a code owner September 21, 2023 12:02
This adds a new Github Action that semantically compares two versions, like 2.1.1 and 2.3.0 giving information about whether or the version is "higher" or "lower" than another version. The action exposes an output called `result` which will match the return type of the PHP [version_compare](https://www.php.net/manual/en/function.version-compare.php) function.

Currently, this action compares `version` against `compare_against` and returns:

- `-1` - if `version` is lower than `compare_against`
- `0` - if `version` is equal to `compare_against`
- `1` - if `version` is greater than `compare_against`

Co-authored-by: Vitaliy Golomoziy <[email protected]>
Copy link
Contributor

@Vinai Vinai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PHP function version_compare doesn't handle -p patch suffixes according to how they are used by Adobe.
The function sorts them before instead of after the version.
Since it is likely we will be using this with Magento's versioning, should we improve on this?

@damienwebdev
Copy link
Member Author

damienwebdev commented Sep 21, 2023

I think so @Vinai - but perhaps in a separate PR, the current use-case (supporting #147) doesn't necessitate that, so YAGNI?

@damienwebdev damienwebdev merged commit 01e4ccb into mage-os:main Sep 21, 2023
@damienwebdev damienwebdev deleted the vit_split_3 branch September 21, 2023 12:36
@mage-os-ci mage-os-ci mentioned this pull request Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants