forked from GitTools/GitVersion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request GitTools#3902 from HHobeck/feature/Replace-the-ver…
…sion-mode-Mainline-Part-V Replace the version mode Mainline in 6.x (Part V)
- Loading branch information
Showing
81 changed files
with
40,364 additions
and
0 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
...Based/TrunkBasedScenariosWithAGitFlow+GivenADevelopBranchWithOneCommitMergedToMainWhen.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
using GitVersion.Configuration; | ||
using GitVersion.Core.Tests; | ||
using GitVersion.Core.Tests.IntegrationTests; | ||
using GitVersion.VersionCalculation; | ||
|
||
namespace GitVersion.Core.TrunkBased; | ||
|
||
internal partial class TrunkBasedScenariosWithAGitFlow | ||
{ | ||
[Parallelizable(ParallelScope.All)] | ||
public class GivenADevelopBranchWithOneCommitMergedToMainWhen | ||
{ | ||
private EmptyRepositoryFixture? fixture; | ||
|
||
private static GitFlowConfigurationBuilder TrunkBasedBuilder => GitFlowConfigurationBuilder.New.WithLabel(null) | ||
.WithVersionStrategy(VersionStrategies.TrunkBased) | ||
.WithBranch("main", _ => _.WithDeploymentMode(DeploymentMode.ManualDeployment)) | ||
.WithBranch("develop", _ => _.WithDeploymentMode(DeploymentMode.ManualDeployment)); | ||
|
||
[OneTimeSetUp] | ||
public void OneTimeSetUp() | ||
{ | ||
// * 55 minutes ago (HEAD -> main) | ||
// |\ | ||
// | * 56 minutes ago (develop) | ||
// |/ | ||
// * 58 minutes ago | ||
|
||
fixture = new EmptyRepositoryFixture("main"); | ||
|
||
fixture.MakeACommit("A"); | ||
fixture.BranchTo("develop"); | ||
fixture.MakeACommit("B"); | ||
fixture.MergeTo("main"); | ||
} | ||
|
||
[OneTimeTearDown] | ||
public void OneTimeTearDown() => fixture?.Dispose(); | ||
|
||
[TestCase(IncrementStrategy.None, IncrementStrategy.None, ExpectedResult = "0.0.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, ExpectedResult = "0.0.1-alpha.1+2")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, ExpectedResult = "0.1.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Major, ExpectedResult = "1.0.0-alpha.1+2")] | ||
|
||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.None, ExpectedResult = "0.0.1-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Patch, ExpectedResult = "0.0.2-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Minor, ExpectedResult = "0.1.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Major, ExpectedResult = "1.0.0-alpha.1+2")] | ||
|
||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.None, ExpectedResult = "0.1.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Patch, ExpectedResult = "0.1.1-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Minor, ExpectedResult = "0.2.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Major, ExpectedResult = "1.0.0-alpha.1+2")] | ||
|
||
[TestCase(IncrementStrategy.Major, IncrementStrategy.None, ExpectedResult = "1.0.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, ExpectedResult = "1.0.1-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, ExpectedResult = "1.1.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, ExpectedResult = "2.0.0-alpha.1+2")] | ||
public string GetVersionWithNoLabelOnMain(IncrementStrategy incrementOnMain, IncrementStrategy increment) | ||
{ | ||
IGitVersionConfiguration trunkBased = TrunkBasedBuilder | ||
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel(null)) | ||
.WithBranch("develop", _ => _.WithIncrement(increment)) | ||
.Build(); | ||
|
||
return fixture!.GetVersion(trunkBased).FullSemVer; | ||
} | ||
|
||
[TestCase(IncrementStrategy.None, IncrementStrategy.None, ExpectedResult = "0.0.0-2+2")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, ExpectedResult = "0.0.1-1+2")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, ExpectedResult = "0.1.0-1+2")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Major, ExpectedResult = "1.0.0-1+2")] | ||
|
||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.None, ExpectedResult = "0.0.1-2+2")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Patch, ExpectedResult = "0.0.2-1+2")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Minor, ExpectedResult = "0.1.0-1+2")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Major, ExpectedResult = "1.0.0-1+2")] | ||
|
||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.None, ExpectedResult = "0.1.0-2+2")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Patch, ExpectedResult = "0.1.1-1+2")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Minor, ExpectedResult = "0.2.0-1+2")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Major, ExpectedResult = "1.0.0-1+2")] | ||
|
||
[TestCase(IncrementStrategy.Major, IncrementStrategy.None, ExpectedResult = "1.0.0-2+2")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, ExpectedResult = "1.0.1-1+2")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, ExpectedResult = "1.1.0-1+2")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, ExpectedResult = "2.0.0-1+2")] | ||
public string GetVersionWithEmptyLabelOnMain(IncrementStrategy incrementOnMain, IncrementStrategy increment) | ||
{ | ||
IGitVersionConfiguration trunkBased = TrunkBasedBuilder | ||
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel(string.Empty)) | ||
.WithBranch("develop", _ => _.WithIncrement(increment)) | ||
.Build(); | ||
|
||
return fixture!.GetVersion(trunkBased).FullSemVer; | ||
} | ||
} | ||
} |
100 changes: 100 additions & 0 deletions
100
...ithAGitFlow+GivenADevelopBranchWithOneCommitMergedToMainWhenMergedCommitTaggedAsStable.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
using GitVersion.Configuration; | ||
using GitVersion.Core.Tests; | ||
using GitVersion.Core.Tests.IntegrationTests; | ||
using GitVersion.VersionCalculation; | ||
|
||
namespace GitVersion.Core.TrunkBased; | ||
|
||
internal partial class TrunkBasedScenariosWithAGitFlow | ||
{ | ||
[Parallelizable(ParallelScope.All)] | ||
public class GivenADevelopBranchWithOneCommitMergedToMainWhenMergedCommitTaggedAsStable | ||
{ | ||
private EmptyRepositoryFixture? fixture; | ||
|
||
private static GitFlowConfigurationBuilder TrunkBasedBuilder => GitFlowConfigurationBuilder.New.WithLabel(null) | ||
.WithVersionStrategy(VersionStrategies.TrunkBased) | ||
.WithBranch("main", _ => _.WithDeploymentMode(DeploymentMode.ManualDeployment)) | ||
.WithBranch("develop", _ => _.WithDeploymentMode(DeploymentMode.ManualDeployment)); | ||
|
||
[OneTimeSetUp] | ||
public void OneTimeSetUp() | ||
{ | ||
// * 55 minutes ago (tag: 1.0.0, main) | ||
// |\ | ||
// | * 56 minutes ago (HEAD -> develop) | ||
// |/ | ||
// * 58 minutes ago | ||
|
||
fixture = new EmptyRepositoryFixture("main"); | ||
|
||
fixture.MakeACommit("A"); | ||
fixture.BranchTo("develop"); | ||
fixture.MakeACommit("B"); | ||
fixture.MergeTo("main"); | ||
fixture.ApplyTag("1.0.0"); | ||
fixture.Checkout("develop"); | ||
} | ||
|
||
[OneTimeTearDown] | ||
public void OneTimeTearDown() => fixture?.Dispose(); | ||
|
||
[TestCase(IncrementStrategy.None, IncrementStrategy.None, ExpectedResult = "1.0.0-alpha.1+0")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, ExpectedResult = "1.0.1-alpha.1+0")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, ExpectedResult = "1.1.0-alpha.1+0")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Major, ExpectedResult = "2.0.0-alpha.1+0")] | ||
|
||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.None, ExpectedResult = "1.0.0-alpha.1+0")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Patch, ExpectedResult = "1.0.1-alpha.1+0")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Minor, ExpectedResult = "1.1.0-alpha.1+0")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Major, ExpectedResult = "2.0.0-alpha.1+0")] | ||
|
||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.None, ExpectedResult = "1.0.0-alpha.1+0")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Patch, ExpectedResult = "1.0.1-alpha.1+0")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Minor, ExpectedResult = "1.1.0-alpha.1+0")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Major, ExpectedResult = "2.0.0-alpha.1+0")] | ||
|
||
[TestCase(IncrementStrategy.Major, IncrementStrategy.None, ExpectedResult = "1.0.0-alpha.1+0")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, ExpectedResult = "1.0.1-alpha.1+0")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, ExpectedResult = "1.1.0-alpha.1+0")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, ExpectedResult = "2.0.0-alpha.1+0")] | ||
public string GetVersionWithTrackMergeTargetOnDevelop(IncrementStrategy incrementOnMain, IncrementStrategy increment) | ||
{ | ||
IGitVersionConfiguration trunkBased = TrunkBasedBuilder | ||
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel(null)) | ||
.WithBranch("develop", _ => _.WithIncrement(increment).WithTrackMergeTarget(true)) | ||
.Build(); | ||
|
||
return fixture!.GetVersion(trunkBased).FullSemVer; | ||
} | ||
|
||
[TestCase(IncrementStrategy.None, IncrementStrategy.None, ExpectedResult = "0.0.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, ExpectedResult = "0.0.1-alpha.1+2")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, ExpectedResult = "0.1.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.None, IncrementStrategy.Major, ExpectedResult = "1.0.0-alpha.1+2")] | ||
|
||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.None, ExpectedResult = "0.0.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Patch, ExpectedResult = "0.0.1-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Minor, ExpectedResult = "0.1.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Patch, IncrementStrategy.Major, ExpectedResult = "1.0.0-alpha.1+2")] | ||
|
||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.None, ExpectedResult = "0.0.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Patch, ExpectedResult = "0.0.1-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Minor, ExpectedResult = "0.1.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Minor, IncrementStrategy.Major, ExpectedResult = "1.0.0-alpha.1+2")] | ||
|
||
[TestCase(IncrementStrategy.Major, IncrementStrategy.None, ExpectedResult = "0.0.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, ExpectedResult = "0.0.1-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, ExpectedResult = "0.1.0-alpha.1+2")] | ||
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, ExpectedResult = "1.0.0-alpha.1+2")] | ||
public string GetVersionWithNoTrackMergeTargetOnDevelop(IncrementStrategy incrementOnMain, IncrementStrategy increment) | ||
{ | ||
IGitVersionConfiguration trunkBased = TrunkBasedBuilder | ||
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel(null)) | ||
.WithBranch("develop", _ => _.WithIncrement(increment).WithTrackMergeTarget(false)) | ||
.Build(); | ||
|
||
return fixture!.GetVersion(trunkBased).FullSemVer; | ||
} | ||
} | ||
} |
Oops, something went wrong.