Skip to content

Commit

Permalink
Update sequence diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
HHobeck committed May 29, 2024
1 parent a9cc731 commit 0276b11
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 5 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,94 @@ public void FeatureFromDevelopBranch(bool withPullRequestIntoDevelop)
fixture.AssertFullSemver("2.1.0-alpha.7", configuration);
}

[TestCase(false)]
[TestCase(true)]
public void FeatureFromDevelopBranchWithMainline(bool withPullRequestIntoDevelop)
{
var configuration = GitFlowConfigurationBuilder.New
.WithNextVersion("1.2.0")
.WithVersionStrategies(VersionStrategies.ConfiguredNextVersion, VersionStrategies.Mainline)
.WithBranch("feature", _ => _.WithIncrement(IncrementStrategy.Minor))
.Build();

using var fixture = new EmptyRepositoryFixture();

fixture.SequenceDiagram.Participant("main");
fixture.SequenceDiagram.Participant("develop");

// GitFlow setup
fixture.SequenceDiagram.Activate("main");
fixture.Repository.MakeACommit();
fixture.ApplyTag("1.2.0");
fixture.AssertFullSemver("1.2.0", configuration);

// Branch from main to develop
fixture.BranchTo("develop", "develop");
fixture.SequenceDiagram.Activate("develop");
fixture.SequenceDiagram.Deactivate("main");
fixture.AssertFullSemver("1.3.0-alpha.0", configuration);

// Branch from develop to feature
const string branchName = "feature/foo";
fixture.BranchTo(branchName, "feature");
fixture.SequenceDiagram.Activate("feature");
fixture.SequenceDiagram.Deactivate("develop");
fixture.AssertFullSemver("1.3.0-foo.1+0", configuration);
fixture.MakeACommit();
fixture.AssertFullSemver("1.3.0-foo.1+1", configuration);

// Create hotfix on main branch
fixture.Checkout("main");
fixture.SequenceDiagram.Activate("main");
fixture.MakeACommit("+semver: minor");
fixture.AssertFullSemver("1.3.0-1", configuration);

// Merge main to develop branch
fixture.MergeTo("develop");
fixture.SequenceDiagram.Deactivate("main");
fixture.SequenceDiagram.Activate("develop");
fixture.AssertFullSemver("1.4.0-alpha.1", configuration);

// Merge develop to feature branch
fixture.Checkout("main");
fixture.MergeTo(branchName);
fixture.SequenceDiagram.Deactivate("develop");
fixture.AssertFullSemver("1.4.0-foo.1+2", configuration);

// Bump to major version increment
fixture.MakeACommit("+semver: major");
fixture.AssertFullSemver("2.0.0-foo.1+3", configuration);

// Create pre-release on feature branch
fixture.ApplyTag("2.1.0-foo.1");
fixture.AssertFullSemver("2.1.0-foo.2+0", configuration);
fixture.MakeACommit();
fixture.AssertFullSemver("2.1.0-foo.2+1", configuration);
fixture.Checkout("develop");

if (withPullRequestIntoDevelop)
{
// Create a PullRequest into develop
fixture.BranchTo("pull/2/merge", "pull");
fixture.SequenceDiagram.Activate("pull/2/merge");
fixture.MergeNoFF(branchName);
fixture.AssertFullSemver("2.1.0-PullRequest2.6", configuration);
fixture.Checkout("develop");
fixture.Remove("pull/2/merge");
}

// Merge feature into develop branch
fixture.MergeNoFF(branchName);
fixture.Remove(branchName);
fixture.SequenceDiagram.NoteOver("Feature branches should\r\nbe deleted once merged", branchName);
fixture.AssertFullSemver("2.1.0-alpha.6", configuration);

// Commit on develop branch
fixture.SequenceDiagram.Activate("develop");
fixture.MakeACommit();
fixture.AssertFullSemver("2.1.0-alpha.7", configuration);
}

[TestCase(false)]
[TestCase(true)]
public void HotfixBranch(bool withPullRequestIntoMain)
Expand Down Expand Up @@ -301,6 +389,8 @@ public void HotfixBranch(bool withPullRequestIntoMain)
fixture.SequenceDiagram.Activate("main");
fixture.MakeACommit();
fixture.AssertFullSemver("2.0.0-6", configuration);
fixture.ApplyTag("2.0.0");
fixture.AssertFullSemver("2.0.0", configuration);
}

[TestCase(false)]
Expand Down Expand Up @@ -442,6 +532,8 @@ public void VersionedHotfixBranch(bool withPullRequestIntoMain)
fixture.SequenceDiagram.Activate("main");
fixture.MakeACommit();
fixture.AssertFullSemver("3.0.1-6", configuration);
fixture.ApplyTag("3.0.1");
fixture.AssertFullSemver("3.0.1", configuration);
}

[TestCase(false)]
Expand Down Expand Up @@ -583,6 +675,8 @@ public void ReleaseBranch(bool withPullRequestIntoMain)
fixture.SequenceDiagram.Activate("main");
fixture.MakeACommit();
fixture.AssertFullSemver("2.0.1-6", configuration);
fixture.ApplyTag("2.0.1");
fixture.AssertFullSemver("2.0.1", configuration);
}

[TestCase(false)]
Expand Down Expand Up @@ -724,6 +818,8 @@ public void VersionedReleaseBranch(bool withPullRequestIntoMain)
fixture.SequenceDiagram.Activate("main");
fixture.MakeACommit();
fixture.AssertFullSemver("3.0.1-6", configuration);
fixture.ApplyTag("3.0.1");
fixture.AssertFullSemver("3.0.1", configuration);
}

[TestCase(false)]
Expand Down Expand Up @@ -852,13 +948,15 @@ public void DevelopBranch(bool withPullRequestIntoMain)
// Create hotfix on main branch
fixture.MakeACommit();
fixture.AssertFullSemver("1.3.1-1", configuration);
fixture.ApplyTag("1.3.1");
fixture.AssertFullSemver("1.3.1", configuration);

// Merge main to release branch
fixture.MergeTo(branchName);
fixture.SequenceDiagram.Deactivate("main");
fixture.AssertFullSemver("1.4.0-alpha.3", configuration);
fixture.AssertFullSemver("1.4.0-alpha.2", configuration);
fixture.MakeACommit("+semver: major");
fixture.AssertFullSemver("2.0.0-alpha.4", configuration);
fixture.AssertFullSemver("2.0.0-alpha.3", configuration);

// Create pre-release on release branch
fixture.ApplyTag("2.1.0-alpha.1");
Expand All @@ -873,20 +971,22 @@ public void DevelopBranch(bool withPullRequestIntoMain)
fixture.BranchTo("pull/2/merge", "pull");
fixture.SequenceDiagram.Activate("pull/2/merge");
fixture.MergeNoFF(branchName);
fixture.AssertFullSemver("2.1.0-PullRequest2.6", configuration);
fixture.AssertFullSemver("2.1.0-PullRequest2.5", configuration);
fixture.Checkout("main");
fixture.Remove("pull/2/merge");
}

// Merge develop into main branch
fixture.MergeNoFF(branchName);
fixture.SequenceDiagram.Deactivate(branchName);
fixture.AssertFullSemver("2.1.0-6", configuration);
fixture.AssertFullSemver("2.1.0-5", configuration);

// Commit on main branch
fixture.SequenceDiagram.Activate("main");
fixture.MakeACommit();
fixture.AssertFullSemver("2.1.0-7", configuration);
fixture.AssertFullSemver("2.1.0-6", configuration);
fixture.ApplyTag("2.1.0");
fixture.AssertFullSemver("2.1.0", configuration);
}

[TestCase(false)]
Expand Down Expand Up @@ -1057,10 +1157,14 @@ public void SupportBranch(bool withPullRequestIntoSupport)
fixture.Checkout("support/1.x");
fixture.MakeACommit();
fixture.AssertFullSemver("1.2.4-1", configuration);
fixture.ApplyTag("1.2.4");
fixture.AssertFullSemver("1.2.4", configuration);

fixture.Checkout("main");
fixture.MergeNoFF("support/1.x");
fixture.AssertFullSemver("2.0.2-2", configuration);
fixture.ApplyTag("2.0.2");
fixture.AssertFullSemver("2.0.2", configuration);
}

[TestCase(false)]
Expand Down

0 comments on commit 0276b11

Please sign in to comment.