-
Notifications
You must be signed in to change notification settings - Fork 183
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
[WIP] switch to MinVer #1484
[WIP] switch to MinVer #1484
Conversation
////Target( | ||
//// "pack-nuspecs", | ||
//// DependsOn("outputDirectory", "get-version"), | ||
//// () => Run(ToolPaths.NuGet, $"pack {AnalyzerMetaPackageNuspecPath} -Version {version} -OutputDirectory {OutputDirectory} -NoPackageAnalysis")); |
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.
There are ways of making this work without using nuget.exe and passing the version explicitly, but for the purpose of this test, I just commented it out. Also, IIRC you were considering getting rid of this meta-package.
Note that the version is |
Nice, @adamralph!
Just to make sure I understand: when we merge the next release branch to master and tag 4.10.0 on master, this will generate a 4.10.0 version, right? |
@thomaslevesque correct. More details here. BTW, regarding this:
We're also working on a feature where you can tell MinVer the minimum major and minor of the mainline integration branch (in your case |
As promised, in alpha 12: 😉 That's proven the alpha for FakeItEasy so I'm closing this. Thanks for hosting this test! 😄 FYI I'm performing the final round of alpha testing now, after which I'll release the first beta. @FakeItEasy/owners would you be interested in switching to MinVer while it's in beta? Or would you rather wait for RC/RTM? Of course, I'm being presumptuous. If you prefer to stick with GitVersion then I'll shut up. 😁 |
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.
Thanks, @adamralph. I like the idea of a simpler versioner (GitVersion never sat that well with me), but am not wild about having to set a variable to say what our preferred major/minor version is. I suppose if we were using GitHubFlow instead of GitFlow, this would not be an issue? Or if we recreated develop after each release…
using System.Reflection; | ||
using System.Resources; | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: AssemblyCompany("Patrik Hägne")] | ||
[assembly: AssemblyCopyright("Copyright (c) FakeItEasy contributors. (fakeiteasyfx@gmail.com)")] |
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.
Why'd you remove these lines?
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.
@blairconrad it's because I had to remove <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
from the projects because the assembly info should come from the project properties rather than a VersionInfo.cs
generated by GitVersion
.
Agreed. Without this, it generates the wrong version when on |
@blairconrad @thomaslevesque that's the trade off for simplicity. MinVer doesn't know anything about branches. You have to tell it which version range the mainline branch is for, if it's not the version implied by the latest tag. I tried to think of all possible ways of avoiding this, but all paths lead back to branch inspection. Upon initial investigation, it may seem we only need a few simple branch checks. Believe me, it's an enormous can of worms best left sealed. I did spike another approach which did inspect branches. It was fiendishly complicated. I never felt completely comfortable that I'd covered all the scenarios. Not to mention that I'd only implemented it for one branching model, Release Flow. To support other branching models I would have had to write a whole load more logic and configuration options. "Can of worms" doesn't do it justice. I hate to think how much complication and maintenance burden this adds to GitVersion.
As I explained above, branches make no difference. There's no getting away from having to tell MinVer the major minor range of the mainline branch. Bear in mind that there is another option: you can push a "dummy" tag, e.g.
I'm not sure why that's happening. I guess we'd need to inspect what the (fiendishly complicated 😉) GitVersion algorithm is doing to figure it out. But to fix it, I suspect you'll have to put the correct version in |
The PR builds currently have bad versions, but the builds on develop are better behaved: build 4.10.0-alpha063.nupkg.
But if we were using GitHubFlow, we'd have a recent tag in the history, would we not? So the new builds on master would have version |
@blairconrad I'm not really sure what you mean. The algorithm that MinVer uses is described here: https://github.com/adamralph/min-ver#algorithm
When MinVer sees an RTM tag in the history, it can't tell if you're now working on the next patch or the next minor. It has to assume patch, since if it assumed minor, it would start producing versions higher than the patch. If you're working on the next minor, you have to tell it, either by pushing a tag or altering |
Yeah, I'd read the algorithm. It wouldn't be branches that would make the difference under GitHubFlow, but the reachability of the tags. I'm put off by the MinVer environment variables and phantom tags, and would prefer not to switch to MinVer while using GitFlow, unless we started recreating develop (equivalently, rebasing onto master) after every release. |
Or maybe just merging master into develop after a release? This would make the tags reachable. |
Do you mean an ugly or a fast-forward merge that's equivalent to a rebase? I could get behind the latter. Oh, heck. I'll mention my other option. We could drop GitFlow. I've not once seen any benefit. |
I wouldn't rely too much on branching solving the problem. Regardless of your branching pattern and the reachable tags, MinVer can't automatically know whether your working on the next patch, the next minor, or the next major. E.g. Using GitHub Flow, you tag But I would argue that GitHub Flow is not really what you want, since then the only releasable thing is When using Release Flow, you would never be working on the next patch in In retrospect I think I've done a bad job so far of selling the concept and my explanations have made MinVer sound more complicated than it is. To make the whole thing easier to understand, I'm considering re-writing the README and renaming some of the input variables. I'll also reduce the env var/property synonyms to only those which actually make sense. Try and forget about "MinVer environment variables and phantom tags". I'll try and re-phrase (as a dress rehearsal for the new README): In any given branch, you are working in a major-minor range. All your release versioning within that range (pre-releases, patches, etc.) is done just by tagging the repo. Now, if you haven't already released (either pre-release or RTM), then there's no tag which indicates the major-minor range. If you want your builds to be in that range before the first release, you tell MinVer the range via the Of course, if you don't care about your builds being in correct range before the first release, then you don't need Note that this is equivalent to GitVersion with respect to major versions. GitVersion can infer a new minor range by inspecting the branch structure, but it can't possibly know that you've moved onto a new major unless you put that in the YAML file. If you don't do that, then GitVersion will also keep building as |
@blairconrad @thomaslevesque FYI I've re-written the README with specific attention to a new Usage section. As ever, your feedback is proving invaluable. I'm enormously grateful, regardless of whether or not you choose to use MinVer. |
Yeah, I guess a fast-forward makes more sense.
Well, I'm not married to GitFlow, so why not. We've been applying it very loosely anyway (we never do hotfix branches, and the release branches never receive any commit, we just merge them to master directly). Maybe Release Flow would work for us. @adamralph thanks for the detailed explanations. Anyway, with out current workflow, we often don't know exactly what the next release will be; it depends on what we committed to develop since the last release. If there are only bug fixes, it's a patch, if there are non-breaking functional changes, it's a minor, and if there are breaking changes, it's a major. So it wouldn't really make sense to set |
@thomaslevesque ah, so in your case, things are even simpler. If you used MinVer, all you'd need to do is push tags. You can ignore the entire conversation above about "phantom" tags, environment variables, and MSBuild properties. 😃 On the topic of workflows, both Git Flow and Release Flow assume that the mainline branch ( After learning about Release Flow, I'm no longer sure there's any use for Git Flow. |
@thomaslevesque, well explained. I'd been assuming that @adamralph was on top of all this, but it's been a while, and there are so many flows in so many different projects, I shouldn't've. Sorry, @adamralph. @adamralph, your workflow for releasing patch versions matches my thinking. In general, I think we'd just release as soon as possible off master, including whatever was in master at the time. If for some reason there was some unreleasable work in master (which hasn't been the case for a very long time), branching from the tag and releasing from there works for me, then merging into master. For me, having current interim builds off master (assuming a GitFlowish workflow) look like 4.9.2-alpha.68 or similar is not a problem. (Although at times having the SHA in there would be convenient, for example when I'm building locally and importing nupkgs into my benchmarks, but this is a nice-to-have, not a necessity. And if I understand things correctly, I might be able to get what I want by using the |
I'm enjoying
and after fixupping that last commit:
|
Oh, nice idea! BTW, I'm not sure if you already know, but Microsoft.SourceLink.GitHub can publish the repository info into the package nuspec if you switch on The element in the nuspec ends up looking something like this: <repository
type="git"
url="https://github.com/adamralph/bullseye.git"
commit="fceca30fbab5d654bb64aaf01a0669064c0997d9" /> ...and that shows up nicely in NuGet Package Explorer: |
Thanks, @adamralph. I did not know this. It looks handy. |
@blairconrad Sourcelink is very nice. You just install the package and it Just Works™. Although I seem to remember there were some wrinkles in FakeItEasy related to the IL merging. Perhaps that was with GitLink? |
It was with SourceLink. #1417. |
It is. But it can also add the repo URL to the package metadata (which we could do manually anyway)
|
I hope you don't mind me sending this PR as a test of the MinVer alpha package. This is not intended to be merged, I just wanted to ensure the package works for FIE in the context of the Appveyor build.
Of course, any feedback is more than welcome.