-
-
Notifications
You must be signed in to change notification settings - Fork 294
Relax semVers pattern according to Issue #163 #171
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #171 +/- ##
=======================================
Coverage 73.50% 73.50%
=======================================
Files 17 17
Lines 385 385
Branches 73 73
=======================================
Hits 283 283
Misses 92 92
Partials 10 10
|
|
In fact, semver already provides a regex: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string maybe we should use this (and then add the |
| 'v0.0-500a-gA9B6C3D0-dirty', | ||
| 'v0.1.0a-26-g6817b33', | ||
| 'is happy with valid %s', | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some more test cases we should use:
2.0.0
2.0.0-rc.2
2.0.0-rc.1
1.0.0
1.0.0-beta
These are provided by https://semver.org/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests do not reflect all new cases, and is a lot more relaxed than just adding one letter to the minor bit.
Either way this is not adhering to semver specification.
A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers, and MUST NOT contain leading zeroes. X is the major version, Y is the minor version, and Z is the patch version. Each element MUST increase numerically. For instance: 1.9.0 -> 1.10.0 -> 1.11.0.
|
thanks for your contribution, I do think it's better too like this. After thinking of it tho, I think the problem is a bit bigger than only the regex. This is a part of the fix, but there's a bigger problem in related issue: I think this will solve it for most cases, but it won't fix the source of the problem: |
|
Exactly. |
|
Ok, let me try to translate the feedback to tasks (tell me if i am wrong ;-)
|
I think you are right. Also note that the output we use there comes from I don't know if that's the best way to grab the latest tag, but it does work. I don't exactly know which path we should take here. @webbertakken mentioned about using semver directly, maybe we should also use some git node package to get a list of tags, but I don't know if it would be too heavy. I'll let @webbertakken determine how it should be implemented ;) |
|
So the idea of automatic versioning is that things become easier. You tag Now in semantic versioning you can have alpha and all, but this is not handled in case of automatic versioning. It's as intended that the build fails for that by the way, as there's no logic handling these edge cases, and i've never taken that into account. When no tag has been set it also works. So everything works out of the box until you need more specific rules for your versioning. A fallback doesn't sound like a good idea, as it's unpredictable and doesn't solve a real problem. For advanced customised versions like 1.0.1a I would actually recommend just using "custom" strategy instead. |
My opinion differ a bit here. By default, it should not fail the build because the version system couldn't find a semver compatible version when I think it should try, but if it fails, it shouldn't use version, but still continue. |
|
I don't disagree. We should probably ignore non-semver versions indeed. |
|
What is about installing a toggle? Strict Mode => Fail when SemVers could not be matched, None Strict Mode => Only give warnings if SemVers could not be matched. ("In case of doubt ask the user" Principle). This would be the way in between because I think both arguments are valid and important! |
|
I think it's an excellent idea. However that would be another option to document and maintain. I'd personally prefer to just make the most favourable option the default, unless there are real use cases that require the second option as well. I think if we simply ignore non-semantic tags and emit a warning for them, we should be fine. That way it stays simple for everyone and we wouldn't bloat the docs with yet another sub-option. |
|
Ok, then I will change the behavior to warn (instead of fail) on non-semVers tags (when I find time :D). Maybe I will also prepare that toggle without exposing it (can then only enabled in code not in config). In that way we can later decide wether it is needed or wether it should be droped bc. of unnecessary complexity. If you are fine with that :). |
|
@caiusno1 do you think you will be able to make the last changes? |
|
I opened a new merge request hence my approach to the issue is quite different now. See #196 |
|
Sorry that it took so long. To be honest I forgot it .... and I currently have less time and motivation for programming because of much work currently. @webbertakken |
|
Fixed in #196 |
Changes
(From the issue i can't figure out what is the right degree of relaxation, but this solutions seems better to me then the current)
Pls mention if I understood the relaxation wrong
related Issue: #163
Checklist