@@ -5,207 +5,10 @@ namespace GitVersion.Core.Tests.IntegrationTests;
5
5
6
6
[ TestFixture ]
7
7
[ Parallelizable ( ParallelScope . All ) ]
8
- public class PhaseGitFlowWithTrunkBasedVersionStrategy
8
+ public class AlignGitFlowWithTrunkBasedVersionStrategy
9
9
{
10
10
private static GitFlowConfigurationBuilder configurationBuilder => GitFlowConfigurationBuilder . New ;
11
11
12
- [ Test ]
13
- public void __Just_A_Test_00__ ( )
14
- {
15
- var builder = configurationBuilder . WithVersionStrategy ( VersionStrategies . TrunkBased ) ;
16
- var configuration = builder
17
- . WithIncrement ( IncrementStrategy . Major )
18
- . WithBranch ( "main" , _ => _
19
- . WithDeploymentMode ( DeploymentMode . ManualDeployment )
20
- . WithIncrement ( IncrementStrategy . Patch )
21
- ) . WithBranch ( "feature" , _ => _
22
- . WithIncrement ( IncrementStrategy . Inherit )
23
- . WithDeploymentMode ( DeploymentMode . ManualDeployment )
24
- ) . Build ( ) ;
25
-
26
- using var fixture = new EmptyRepositoryFixture ( "main" ) ;
27
-
28
- fixture . MakeACommit ( "A" ) ;
29
- fixture . BranchTo ( "feature/foo" ) ;
30
- fixture . MakeACommit ( "B" ) ;
31
-
32
- // ✅ succeeds as expected
33
- fixture . AssertFullSemver ( "0.0.2-foo.1+1" , configuration ) ;
34
-
35
- fixture . BranchTo ( "feature/bar" ) ;
36
-
37
- // ✅ succeeds as expected
38
- fixture . AssertFullSemver ( "0.0.2-bar.1+1" , configuration ) ;
39
-
40
- fixture . MakeACommit ( "C" ) ;
41
-
42
- // ✅ succeeds as expected
43
- fixture . AssertFullSemver ( "0.0.2-bar.1+2" , configuration ) ;
44
- }
45
-
46
- [ TestCase ( true , "release/0.0.0" ) ]
47
- public void __Just_A_Test_01__ ( bool useTrunkBased , string releaseBranch )
48
- {
49
- var builder = useTrunkBased
50
- ? configurationBuilder . WithVersionStrategy ( VersionStrategies . TrunkBased )
51
- : configurationBuilder ;
52
- var configuration = builder
53
- . WithIncrement ( IncrementStrategy . Major )
54
- . WithBranch ( "main" , _ => _
55
- . WithDeploymentMode ( DeploymentMode . ManualDeployment )
56
- . WithIncrement ( IncrementStrategy . Patch )
57
- ) . WithBranch ( "release" , _ => _
58
- . WithIncrement ( IncrementStrategy . Inherit )
59
- . WithDeploymentMode ( DeploymentMode . ManualDeployment )
60
- ) . WithBranch ( "feature" , _ => _
61
- . WithIncrement ( IncrementStrategy . Inherit )
62
- . WithDeploymentMode ( DeploymentMode . ManualDeployment )
63
- ) . Build ( ) ;
64
-
65
- using var fixture = new EmptyRepositoryFixture ( "main" ) ;
66
-
67
- fixture . MakeACommit ( "A" ) ;
68
-
69
- // ✅ succeeds as expected
70
- fixture . AssertFullSemver ( "0.0.1-1+1" , configuration ) ;
71
-
72
- if ( ! useTrunkBased ) fixture . ApplyTag ( "0.0.1" ) ;
73
- fixture . BranchTo ( releaseBranch ) ;
74
-
75
- // ✅ succeeds as expected
76
- fixture . AssertFullSemver ( "0.0.2-beta.1+0" , configuration ) ;
77
-
78
- fixture . MakeACommit ( "B" ) ;
79
-
80
- // ✅ succeeds as expected
81
- fixture . AssertFullSemver ( "0.0.2-beta.1+1" , configuration ) ;
82
-
83
- fixture . BranchTo ( "feature/foo" ) ;
84
-
85
- // ✅ succeeds as expected
86
- fixture . AssertFullSemver ( "0.0.2-foo.1+1" , configuration ) ;
87
-
88
- fixture . MakeACommit ( "C" ) ;
89
-
90
- // ✅ succeeds as expected
91
- fixture . AssertFullSemver ( "0.0.2-foo.1+2" , configuration ) ;
92
-
93
- fixture . MakeACommit ( "D" ) ;
94
-
95
- // ✅ succeeds as expected
96
- fixture . AssertFullSemver ( "0.0.2-foo.1+3" , configuration ) ;
97
-
98
- fixture . ApplyTag ( "0.0.2-foo.1" ) ;
99
-
100
- // ✅ succeeds as expected
101
- fixture . AssertFullSemver ( "0.0.2-foo.2+0" , configuration ) ;
102
-
103
- fixture . MakeACommit ( "E" ) ;
104
-
105
- // ✅ succeeds as expected
106
- fixture . AssertFullSemver ( "0.0.2-foo.2+1" , configuration ) ;
107
-
108
- fixture . Checkout ( releaseBranch ) ;
109
- fixture . BranchTo ( "pull/2/merge" ) ;
110
- fixture . MergeNoFF ( "feature/foo" ) ;
111
-
112
- // ✅ succeeds as expected
113
- fixture . AssertFullSemver ( "0.0.2-PullRequest2.5" , configuration ) ;
114
-
115
- fixture . Checkout ( "feature/foo" ) ;
116
- fixture . MergeTo ( releaseBranch , removeBranchAfterMerging : true ) ;
117
-
118
- // ✅ succeeds as expected
119
- fixture . AssertFullSemver ( "0.0.2-beta.1+5" , configuration ) ;
120
-
121
- fixture . MergeTo ( "main" , removeBranchAfterMerging : true ) ;
122
-
123
- if ( useTrunkBased )
124
- {
125
- // ✅ succeeds as expected
126
- fixture . AssertFullSemver ( "0.0.2-1+6" , configuration ) ;
127
- }
128
- else
129
- {
130
- // ❔ expected: "0.0.2-1+6"
131
- fixture . AssertFullSemver ( "0.0.2-1+6" , configuration ) ;
132
- }
133
-
134
- if ( ! useTrunkBased ) fixture . ApplyTag ( "0.0.2" ) ;
135
- fixture . MakeACommit ( "F" ) ;
136
-
137
- // ✅ succeeds as expected
138
- fixture . AssertFullSemver ( "0.0.3-1+1" , configuration ) ;
139
- }
140
-
141
- [ TestCase ( true ) ]
142
- public void __Just_A_Test_02__ ( bool useTrunkBased )
143
- {
144
- var builder = useTrunkBased
145
- ? configurationBuilder . WithVersionStrategy ( VersionStrategies . TrunkBased )
146
- : configurationBuilder ;
147
- var configuration = builder
148
- . WithIncrement ( IncrementStrategy . Major )
149
- . WithBranch ( "main" , _ => _
150
- . WithDeploymentMode ( DeploymentMode . ManualDeployment )
151
- . WithIncrement ( IncrementStrategy . Inherit )
152
- ) . WithBranch ( "feature" , _ => _
153
- . WithIncrement ( IncrementStrategy . Minor )
154
- ) . Build ( ) ;
155
-
156
- using var fixture = new EmptyRepositoryFixture ( "main" ) ;
157
-
158
- fixture . MakeACommit ( "A" ) ;
159
-
160
- // ✅ succeeds as expected
161
- fixture . AssertFullSemver ( "1.0.0-1+1" , configuration ) ;
162
-
163
- if ( ! useTrunkBased ) fixture . ApplyTag ( "1.0.0" ) ;
164
- fixture . MakeACommit ( "B" ) ;
165
-
166
- // ✅ succeeds as expected
167
- fixture . AssertFullSemver ( "2.0.0-1+1" , configuration ) ;
168
-
169
- if ( ! useTrunkBased ) fixture . ApplyTag ( "2.0.0" ) ;
170
- fixture . BranchTo ( "feature/foo" ) ;
171
-
172
- // ✅ succeeds as expected
173
- fixture . AssertFullSemver ( "2.1.0-foo.1+0" , configuration ) ;
174
-
175
- fixture . MakeACommit ( "C" ) ;
176
-
177
- // ✅ succeeds as expected
178
- fixture . AssertFullSemver ( "2.1.0-foo.1+1" , configuration ) ;
179
-
180
- fixture . ApplyTag ( "2.1.0-foo.1" ) ;
181
-
182
- // ✅ succeeds as expected
183
- fixture . AssertFullSemver ( "2.1.0-foo.2+0" , configuration ) ;
184
-
185
- fixture . MakeACommit ( "D" ) ;
186
-
187
- // ✅ succeeds as expected
188
- fixture . AssertFullSemver ( "2.1.0-foo.2+1" , configuration ) ;
189
-
190
- fixture . MakeACommit ( "E" ) ;
191
-
192
- // ✅ succeeds as expected
193
- fixture . AssertFullSemver ( "2.1.0-foo.2+2" , configuration ) ;
194
-
195
- fixture . MergeTo ( "main" ) ;
196
-
197
- if ( useTrunkBased )
198
- {
199
- // ✅ succeeds as expected
200
- fixture . AssertFullSemver ( "2.1.0-1+4" , configuration ) ;
201
- }
202
- else
203
- {
204
- // ❔ expected: "2.1.0-1+4"
205
- fixture . AssertFullSemver ( "3.0.0-1+4" , configuration ) ;
206
- }
207
- }
208
-
209
12
/// <summary>
210
13
/// GitHubFlow - Feature branch (Increment inherit on main and inherit on feature)
211
14
/// </summary>
0 commit comments