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
Rework buildscripts for easier management #749
Conversation
What does this mean regarding Semantic Versioning? (AutoFixture follows Semantic Versioning 2.0.0) |
@moodmosaic A good question. Likely, it was too wide statement so it caused some confusion :) Let me describe why I added it. I wanted to simplify version management, so it's controlled by tags only. Idea is that if you create a tag, it's used as a version for your assemblies. Additionally I wanted to add support for the Dev feed to have a place which we could consume before a new release is tagged and published to NuGet. Feed might be more suitable as CI artifacts as you can consume it by VS easier. For the Production feed (NuGet) the SemVer is never violated - we push on tags only. For such cases number of commits since last tag is always zero. Release manager will manage tags according to SemVer, so it will be honored. For the Dev feed (MyGet) SemVer will not be violated for the It would be very redundant to track SemVer for the Dev feed, so we 2 options only - disable Dev feed for the Master branch or have it knowning that this is a private feed with latest artifacts. I'd vote for the last option as such a feed might be very useful sometimes. |
d924a61
to
f3f92e9
Compare
I've just rebased my code to remove doc for FAKE from repo - it takes about 10MB :) Again, most changes were done for a few files only, so likely you could focus on the following files only:
|
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.
Thank you for contributing this! I support the idea of automating the release process by baking it into the build script 👍
However, there are a few issues that need to be addressed before we can move forward.
Build.fsx
Outdated
@@ -173,6 +173,7 @@ Target "PublishNuGetRelease" (fun _ -> publishPackagesToNuGet | |||
(getBuildParam "NuGetReleaseKey")) | |||
|
|||
Target "CompleteBuild" (fun _ -> ()) | |||
Target "PublishNuGetAll" (fun _ -> ()) |
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.
How are the changes in this file related to the commit message? Shouldn't this be part of another commit or even be committed separately?
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.
Done - moved this change to the previous commit.
Build.fsx
Outdated
@@ -19,7 +19,9 @@ let build target configuration = | |||
let properties = [ "Configuration", configuration ] @ keyFile | |||
|
|||
solutionsToBuild | |||
|> MSBuild "" target properties | |||
|> Seq.iter (fun s -> build (fun p -> { p with Verbosity = Some(Minimal) |
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 set the verbosity to minimal? Don't we want to have as much information as possible when troubleshooting?
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.
I did that intentionally, as it was impossible to track review the build log on CI - browser hung after the pressure of number of build entries.
However, later (in migration to .NET Core branch I'm currently working on) I found that we perform a lot of redundant rebuilds, so probably we could revert this setting back. Will update soon.
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.
Done - keep normal verbosity
Build.fsx
Outdated
|
||
let releaseFolder = "Release" | ||
let nunitToolsFolder = "Packages/NUnit.Runners.2.6.2/tools" | ||
let nuGetOutputFolder = "NuGetPackages" | ||
let solutionsToBuild = !! "Src/*.sln" | ||
let signKeyPath = FullName "Src/AutoFixture.snk" | ||
|
||
type GitVersion = { apiVersion:string; nugetVersion:string; } | ||
let getGitVersion = |
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.
I like the idea of letting the version number be calculated based on the history. 👍
However, I strongly suggest we use an established tool like GitVersion for that instead of rolling our own.
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.
I do like idea of switching to GitVersion tool, FAKE even have helpers for it, however I don't have experience with that tool. It would take some time for me to read the documentation.
Currently I'm focused on migration to .NET Core, so would like to have this PR merged as soon as possible.
Would it be OK for you if merge this PR as is and switch to GitVersion
in v4
branch later?
Build.fsx
Outdated
@@ -13,7 +13,7 @@ let nuGetOutputFolder = "NuGetPackages" | |||
let solutionsToBuild = !! "Src/*.sln" | |||
let signKeyPath = FullName "Src/AutoFixture.snk" | |||
|
|||
type GitVersion = { apiVersion:string; nugetVersion:string; } | |||
type GitVersion = { apiVersion:string; nugetVersion:string } |
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.
I think this whole commit should be squashed into 6e6dad9 as it's unclear what it does on its own. What's the "optimization" here?
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.
Done - squashed entire commit with the previous one
Build.fsx
Outdated
@@ -17,7 +17,7 @@ type GitVersion = { apiVersion:string; nugetVersion:string } | |||
let getGitVersion = | |||
let desc = Git.CommandHelper.runSimpleGitCommand "" "describe --tags --long --match=v*" | |||
// Example for regular: v3.50.2-288-g64fd5c5b, for prerelease: v3.50.2-alpha1-288-g64fd5c5b | |||
let result = Regex.Match(desc, @"^v(?<maj>\d+)\.(?<min>\d+)\.(?<rev>\d+)(?<pre>-(alpha|beta|rc)\d*)?-(?<num>\d+)-g(?<sha>[a-z0-9]+)$", RegexOptions.IgnoreCase).Groups | |||
let result = Regex.Match(desc, @"^v(?<maj>\d+)\.(?<min>\d+)\.(?<rev>\d+)(?<pre>-\w+\d*)?-(?<num>\d+)-g(?<sha>[a-z0-9]+)$", RegexOptions.IgnoreCase).Groups |
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.
Again, it would be better if we didn't have to support all these use cases on our own. See my previous comment.
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.
See reply below. Let's close this thread ;)
@@ -1,4 +1,4 @@ | |||
#r @"packages/FAKE.4.19.0/tools/FakeLib.dll" | |||
#r @"packages/FAKE.Core/tools/FakeLib.dll" |
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.
It's hard to get an overview of the changes related to updating FAKE when there are another 150K+ deleted lines. Could you please commit the deletion of the old package separately?
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.
Do you want me to perform the rebase and just separate add/remove as separate commits, or want me to rebase and remove this from PR at all, so it will be fired via separate PR later?
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.
I think a separate commit for deleting the old package (and its related documentation) is enough. No need for a new PR. 😉
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.
Done - separated to 2 standalone commits.
@zvirja Thank you for your contribution! I left a few comments in my review. Also, I noticed that the build on AppVeyor is currently broken on Could you please make a new PR with a new |
I do understand your concern regarding the build failing for the master, however there was no other way. I needed to remove the previous AppVeyor project, so currently it relies on Do you believe that it makes sense to create a temp |
In OSS, "soon" could literally mean anything 😉 I still think we should get the build running on |
f3f92e9
to
488db65
Compare
@ecampidoglio I've followed up all the points above and fixed them (except the GitVersion one). Thank you for such a brilliant code review. Let's follow this way. If PR is not approved by you and {@moodmosaic or @adamchester} till evening, I'll create this file and add it directly to master - it's pretty simple. |
@ecampidoglio I noticed that you liked the reply, but haven't replied here and haven't approved the PR. Does that mean that you don't agree? 😏 |
FAKE should be updated to support MSBuild from VS 2017. FAKE.Core package is used instead of full FAKE because it's smaller, while all the required functionality is present.
488db65
to
de25f50
Compare
@ecampidoglio I've pushed legacy configuration, so now our CI is green. I've also spent few hours playing with GitVersion tool and I hate it 😠 While I find it awesome in some aspects, there is one thing which blows my head up. Tool simply doesn't work property with pre-release tags ending with numbers. Consider the following flow:
The issue is that SemVer tool simply trims numbers at the end of your pre-release tag. Meaning, that you cannot release If you tweak configuration a bit and play with I'm too silly to make it work fine 😢 Therefore, if you could find free time, please rework approach to use this tool instead of the regular expressions. In the meanwhile, I'd like to ask to approve as is. I've improved my clutch to format with commits number with padding - I've found that NuGet might not support SemVer 2.0 properly. I'd be really happy it you can adapt GitVersion tool for tags with ending numbers. |
Last tag and number of commits since last tag is used to determine version. Resolved version is written to the AssemblyInformationalVersion attribute for each assembly. Later during NuGet pack this version is used as a NuGet version. This approach allows to simplify Release Management by controlling releases via tags creation only.
It appears that NuGet doesn't fully support SemVer 2.0. Format commits number wtih 4 digits so lex comparison will compare values correctly
de25f50
to
bfb5643
Compare
I've been viewing this item on-and-off the past few days and I have to admit that I'm having a hard time understanding what it does 😕 Though, as long as @ecampidoglio is reviewing this, I feel safe 😃 But maybe we should consider splitting this in smaller pull requests? |
@moodmosaic Thank you for the time you spent on this. Likely, the most confusion is caused by the FAKE update which brought a huge number of diffs. Could you clarify which exact parts caused the confusion to you? We could split it to a separate PRs if that is needed, but I need to understand which exact commits you want to group. |
@zvirja, I just can't understand what happens next if/when this pull request gets merged 😕 (I'm not saying that the pull request is bad, just that I can't understand exactly what it does.) |
From what I gather, this PR does a few different things:
They all go under the umbrella of automating the release process, but I have to say that multiple PRs for each of those items would be easier to manage. |
Ok, let me describe that :) As I mentioned above, the main purpose of these changes is to use repository status to understand current version, rather than need to patch all the AssemblyInfo files instead. We use current/last tag and number of commits since last tag to automatically generate assembly version. Also I added the MyGet feed for the pre-release builds (e.g. for the v4). Changes by files:
All this staff just allows you to simplify the release procedure. Now all you need is just to create a SemVer tag - build script will use it as a version for versions and nuget packages. |
@ecampidoglio, @zvirja, if you agree, based on this and this, it will be faster then to get this done if it gets split into smaller, separate pull requests. |
@ecampidoglio appeared to be quicker than me 😉 |
@zvirja, probably it's just me, but I see each item on this list by @ecampidoglio as a separate pull request. |
Actually, I would prefer to have separate PRs for each of the items that I listed here, assuming I'm not missing anything. The reason is that we might not want to have everything. For example, while the automatic versioning might be good, we might want to hold off on the MyGet feed. |
Thanks for the feedback. Likely, that is how review system works in OSS projects - you need to make small granularity changes. I could rework that to the small sub-sets, the are couple of issues with that:
However, by submitting that I'm ready to do that. If you really need that, feel that it would be better for everybody and we cannot accept 2 PRs with FAKE update and everything else - I'll do that! I appreciate the time you spend on this, I want to collaborate and to not make a chaos in our project 😉 |
@zvirja Thank you for understanding. Your efforts are very appreciated 😃 In the future, it's better to discuss your proposed changes with the team first, before you do any actual work (with the exception of a small POC, if necessary). That way, you'll avoid investing a huge chunk of your time doing something that might not align with the vision the rest of the team has for the project. The preferred way to do that is to create an issue and have the initial discussion there. Once we agree on the course of action, you can submit one or more PRs in reference to that issue. Again, I want to empathize that I really appreciate your enthusiasm and your will to do good! We just need to dial it back a little so that we don't rock the boat too hard 😉 |
@ecampidoglio Thanks for the appreciation 😌 Ok, let's follow this way. I've already created the first PR with FAKE update and will create more after it will be approved. I close this one as it will not be merged. |
I've reworked build scripts and CI configuration to simplify release management. Now current package version is calculated automatically based on the last tag and number of commits since tag. Also I've configured both CI and our
build.fsx
to automatically push packages to appropriate NuGet feeds.The matrix is following (
0
means any digit):v0.0.0
orv.0.0.0-RC0
0.0.0
or0.0.0-RC0
v0.0.0-aplha0
(any pre suffix)0.0.0-aplha0
v0.0.0
to master/v40.0.0.2
Other changes:
FAKE.Core
package usage as it takes less space.AssemblyInformationalVersion
to each assembly.appveyor.yml
appveyor.yml
appveyor.yml
. Likely, that is because of this.After I merge this PR to
master
, I'll merge it tov4
and will tune it a bit for .NET Core projects (e.g. change VS image version).P.S. Large number of changes is caused by FAKE update. The only interesting changes might be
build.fsx
,appveyor.yml
andAssemblyInfo.cs
files.