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

Add semantic version comparison. #5

Merged
merged 8 commits into from
Feb 24, 2024
Merged

Add semantic version comparison. #5

merged 8 commits into from
Feb 24, 2024

Conversation

Hug0-Drelon
Copy link
Member

@Hug0-Drelon Hug0-Drelon commented Feb 20, 2024

What?

Fixes #1
Allow third party to run PHPUnit test for old WordPress version which requires old PHPUnit versions.
Use semantic version comparison to achieve that.

How?

  • Create a new action version-compare to compare to versions with a optional operator (default to "<").
  • This action accepts "dev", "latest" and "nightly" as version and assume they're the highest version.
  • Use this new version-compare action in phpunit action to require the correct PHPUnit version depending on the current WordPress veersion.

Limits

The version compare action is not able to correctly compare two versions if "dev", "latest" or "nightly" is passed for both versions.

@Hug0-Drelon Hug0-Drelon self-assigned this Feb 20, 2024
bin/version-compare.sh Outdated Show resolved Hide resolved
@szepeviktor
Copy link

szepeviktor commented Feb 22, 2024

You can use Debian's (also derivatives like Ubuntu) dpkg command.

if dpkg --compare-versions "17.4.0" lt "8.0"; then

fi

@Hug0-Drelon
Copy link
Member Author

Thanks for the suggestion @szepeviktor!
Much simpler your way 😄

bin/version-compare.sh Outdated Show resolved Hide resolved
Co-authored-by: Viktor Szépe <[email protected]>
@Hug0-Drelon Hug0-Drelon merged commit cb980c2 into main Feb 24, 2024
@Hug0-Drelon Hug0-Drelon deleted the ver-comp branch February 24, 2024 13:08
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.

Use a more robust way to compare versions
3 participants