1
- using GitVersion . Configuration ;
1
+ using GitVersion . Extensions ;
2
+ using GitVersion . VersionCalculation ;
2
3
3
4
namespace GitVersion . Core . Tests . Helpers ;
4
5
@@ -8,8 +9,183 @@ internal sealed class GitFlowConfigurationBuilder : TestConfigurationBuilderBase
8
9
9
10
private GitFlowConfigurationBuilder ( )
10
11
{
11
- ConfigurationBuilder configurationBuilder = new ( ) ;
12
- var configuration = configurationBuilder . Build ( ) ;
13
- WithConfiguration ( configuration ) ;
12
+ WithConfiguration ( new ( )
13
+ {
14
+ AssemblyVersioningScheme = AssemblyVersioningScheme . MajorMinorPatch ,
15
+ AssemblyFileVersioningScheme = AssemblyFileVersioningScheme . MajorMinorPatch ,
16
+ TagPrefix = "[vV]" ,
17
+ VersioningMode = VersioningMode . ContinuousDelivery ,
18
+ ContinuousDeploymentFallbackTag = "ci" ,
19
+ MajorVersionBumpMessage = IncrementStrategyFinder . DefaultMajorPattern ,
20
+ MinorVersionBumpMessage = IncrementStrategyFinder . DefaultMinorPattern ,
21
+ PatchVersionBumpMessage = IncrementStrategyFinder . DefaultPatchPattern ,
22
+ NoBumpMessage = IncrementStrategyFinder . DefaultNoBumpPattern ,
23
+ CommitMessageIncrementing = CommitMessageIncrementMode . Enabled ,
24
+ CommitDateFormat = "yyyy-MM-dd" ,
25
+ UpdateBuildNumber = true ,
26
+ SemanticVersionFormat = SemanticVersionFormat . Strict ,
27
+ TagPreReleaseWeight = 60000 ,
28
+ Increment = IncrementStrategy . Inherit
29
+ } ) ;
30
+
31
+ WithBranch ( DevelopBranch . Name ) . WithConfiguration ( new ( )
32
+ {
33
+ VersioningMode = VersioningMode . ContinuousDeployment ,
34
+ Increment = IncrementStrategy . Minor ,
35
+ Regex = DevelopBranch . RegexPattern ,
36
+ SourceBranches = new HashSet < string > ( ) ,
37
+ Tag = "alpha" ,
38
+ PreventIncrementOfMergedBranchVersion = false ,
39
+ TrackMergeTarget = true ,
40
+ TracksReleaseBranches = true ,
41
+ IsMainline = false ,
42
+ IsReleaseBranch = false ,
43
+ PreReleaseWeight = 0
44
+ } ) ;
45
+
46
+ WithBranch ( MainBranch . Name ) . WithConfiguration ( new ( )
47
+ {
48
+ VersioningMode = VersioningMode . ContinuousDelivery ,
49
+ Increment = IncrementStrategy . Patch ,
50
+ Regex = MainBranch . RegexPattern ,
51
+ SourceBranches = new HashSet < string > {
52
+ DevelopBranch . Name ,
53
+ ReleaseBranch . Name
54
+ } ,
55
+ Tag = string . Empty ,
56
+ PreventIncrementOfMergedBranchVersion = true ,
57
+ TrackMergeTarget = false ,
58
+ TracksReleaseBranches = false ,
59
+ IsMainline = true ,
60
+ IsReleaseBranch = false ,
61
+ PreReleaseWeight = 55000
62
+ } ) ;
63
+
64
+ WithBranch ( ReleaseBranch . Name ) . WithConfiguration ( new ( )
65
+ {
66
+ VersioningMode = VersioningMode . ContinuousDelivery ,
67
+ Increment = IncrementStrategy . None ,
68
+ Regex = ReleaseBranch . RegexPattern ,
69
+ SourceBranches = new HashSet < string > {
70
+ DevelopBranch . Name ,
71
+ MainBranch . Name ,
72
+ SupportBranch . Name ,
73
+ ReleaseBranch . Name
74
+ } ,
75
+ Tag = "beta" ,
76
+ PreventIncrementOfMergedBranchVersion = true ,
77
+ TrackMergeTarget = false ,
78
+ TracksReleaseBranches = false ,
79
+ IsMainline = false ,
80
+ IsReleaseBranch = true ,
81
+ PreReleaseWeight = 30000
82
+ } ) ;
83
+
84
+ WithBranch ( FeatureBranch . Name ) . WithConfiguration ( new ( )
85
+ {
86
+ VersioningMode = VersioningMode . ContinuousDelivery ,
87
+ Increment = IncrementStrategy . Inherit ,
88
+ Regex = FeatureBranch . RegexPattern ,
89
+ SourceBranches = new HashSet < string > {
90
+ DevelopBranch . Name ,
91
+ MainBranch . Name ,
92
+ ReleaseBranch . Name ,
93
+ FeatureBranch . Name ,
94
+ SupportBranch . Name ,
95
+ HotfixBranch . Name
96
+ } ,
97
+ Tag = "{BranchName}" ,
98
+ PreReleaseWeight = 30000
99
+ } ) ;
100
+
101
+ WithBranch ( PullRequestBranch . Name ) . WithConfiguration ( new ( )
102
+ {
103
+ VersioningMode = VersioningMode . ContinuousDelivery ,
104
+ Increment = IncrementStrategy . Inherit ,
105
+ Regex = PullRequestBranch . RegexPattern ,
106
+ SourceBranches = new HashSet < string > {
107
+ DevelopBranch . Name ,
108
+ MainBranch . Name ,
109
+ ReleaseBranch . Name ,
110
+ FeatureBranch . Name ,
111
+ SupportBranch . Name ,
112
+ HotfixBranch . Name
113
+ } ,
114
+ Tag = "PullRequest" ,
115
+ TagNumberPattern = @"[/-](?<number>\d+)" ,
116
+ PreReleaseWeight = 30000
117
+ } ) ;
118
+
119
+ WithBranch ( HotfixBranch . Name ) . WithConfiguration ( new ( )
120
+ {
121
+ VersioningMode = VersioningMode . ContinuousDelivery ,
122
+ Increment = IncrementStrategy . Inherit ,
123
+ Regex = HotfixBranch . RegexPattern ,
124
+ SourceBranches = new HashSet < string > {
125
+ ReleaseBranch . Name ,
126
+ MainBranch . Name ,
127
+ SupportBranch . Name ,
128
+ HotfixBranch . Name
129
+ } ,
130
+ Tag = "beta" ,
131
+ PreReleaseWeight = 30000
132
+ } ) ;
133
+
134
+ WithBranch ( SupportBranch . Name ) . WithConfiguration ( new ( )
135
+ {
136
+ VersioningMode = VersioningMode . ContinuousDelivery ,
137
+ Increment = IncrementStrategy . Patch ,
138
+ Regex = SupportBranch . RegexPattern ,
139
+ SourceBranches = new HashSet < string > { MainBranch . Name } ,
140
+ Tag = string . Empty ,
141
+ PreventIncrementOfMergedBranchVersion = true ,
142
+ TrackMergeTarget = false ,
143
+ TracksReleaseBranches = false ,
144
+ IsMainline = true ,
145
+ IsReleaseBranch = false ,
146
+ PreReleaseWeight = 55000
147
+ } ) ;
14
148
}
149
+
150
+ public static BranchMetaData MainBranch = new ( )
151
+ {
152
+ Name = "main" ,
153
+ RegexPattern = "^master$|^main$"
154
+ } ;
155
+
156
+ public static BranchMetaData DevelopBranch = new ( )
157
+ {
158
+ Name = "develop" ,
159
+ RegexPattern = "^dev(elop)?(ment)?$"
160
+ } ;
161
+
162
+ public static BranchMetaData ReleaseBranch = new ( )
163
+ {
164
+ Name = "release" ,
165
+ RegexPattern = "^releases?[/-]"
166
+ } ;
167
+
168
+ public static BranchMetaData FeatureBranch = new ( )
169
+ {
170
+ Name = "feature" ,
171
+ RegexPattern = "^features?[/-]"
172
+ } ;
173
+
174
+ public static BranchMetaData PullRequestBranch = new ( )
175
+ {
176
+ Name = "pull-request" ,
177
+ RegexPattern = @"^(pull|pull\-requests|pr)[/-]"
178
+ } ;
179
+
180
+ public static BranchMetaData HotfixBranch = new ( )
181
+ {
182
+ Name = "hotfix" ,
183
+ RegexPattern = "^hotfix(es)?[/-]"
184
+ } ;
185
+
186
+ public static BranchMetaData SupportBranch = new ( )
187
+ {
188
+ Name = "support" ,
189
+ RegexPattern = "^support[/-]"
190
+ } ;
15
191
}
0 commit comments