Skip to content

Commit da52067

Browse files
committed
Merge branch 'support/5.x' into main
2 parents 46082b4 + b7d207f commit da52067

File tree

17 files changed

+164
-36
lines changed

17 files changed

+164
-36
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v3
12-
- uses: peter-evans/repository-dispatch@v1.1.3
12+
- uses: peter-evans/repository-dispatch@v2
1313
with:
1414
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
1515
repository: ${{ github.repository }}

docs/input/docs/learn/who.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ that we know about today.
1212
* [ChocolateyGUI](https://github.com/chocolatey/ChocolateyGUI)
1313
* [GitLink](https://github.com/GitTools/GitLink)
1414
* [OctopusDeploy](https://github.com/OctopusDeploy)
15+
* [NUKE](https://nuke.build)
1516
* [Orc.\* packages](https://github.com/wildgums?query=orc)
1617
* [Orchestra](https://github.com/wildgums/orchestra)
1718
* [Pomona](http://pomona.io/)
@@ -20,6 +21,7 @@ that we know about today.
2021
* [Splat](https://github.com/paulcbetts/splat)
2122
* [ReactiveUI](https://github.com/reactiveui/reactiveui)
2223
* [Uno Platform](https://platform.uno/)
24+
* [Fluent Assertions](https://fluentassertions.com)
2325

2426
If you are using GitVersion in your projects, and you are not listed above,
2527
please feel free to add a link to your project.

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<PackageVersion_MicrosoftTestSdk>17.1.0</PackageVersion_MicrosoftTestSdk>
3838
<PackageVersion_NSubstitute>4.3.0</PackageVersion_NSubstitute>
3939
<PackageVersion_CoverletMsBuild>3.1.2</PackageVersion_CoverletMsBuild>
40-
<PackageVersion_NUnit>3.13.2</PackageVersion_NUnit>
40+
<PackageVersion_NUnit>3.13.3</PackageVersion_NUnit>
4141
<PackageVersion_NUnit3TestAdapter>4.2.1</PackageVersion_NUnit3TestAdapter>
4242
<PackageVersion_NunitXmlTestLogger>3.0.117</PackageVersion_NunitXmlTestLogger>
4343
<PackageVersion_Shouldly>4.0.3</PackageVersion_Shouldly>

src/GitVersion.Core.Tests/BuildAgents/AzurePipelinesTests.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,43 @@ public void AzurePipelinesBuildNumberWithSemVer(string buildNumberFormat, string
8080
var logMessage = this.buildServer.GenerateSetVersionMessage(vars);
8181
logMessage.ShouldBe(logPrefix + expectedBuildNumber);
8282
}
83+
84+
[Test]
85+
public void GetCurrentBranchShouldHandleBranches()
86+
{
87+
// Arrange
88+
this.environment.SetEnvironmentVariable("BUILD_SOURCEBRANCH", $"refs/heads/{MainBranch}");
89+
90+
// Act
91+
var result = this.buildServer.GetCurrentBranch(false);
92+
93+
// Assert
94+
result.ShouldBe($"refs/heads/{MainBranch}");
95+
}
96+
97+
[Test]
98+
public void GetCurrentBranchShouldHandleTags()
99+
{
100+
// Arrange
101+
this.environment.SetEnvironmentVariable("BUILD_SOURCEBRANCH", "refs/tags/1.0.0");
102+
103+
// Act
104+
var result = this.buildServer.GetCurrentBranch(false);
105+
106+
// Assert
107+
result.ShouldBeNull();
108+
}
109+
110+
[Test]
111+
public void GetCurrentBranchShouldHandlePullRequests()
112+
{
113+
// Arrange
114+
this.environment.SetEnvironmentVariable("BUILD_SOURCEBRANCH", "refs/pull/1/merge");
115+
116+
// Act
117+
var result = this.buildServer.GetCurrentBranch(false);
118+
119+
// Assert
120+
result.ShouldBeNull();
121+
}
83122
}

src/GitVersion.Core.Tests/BuildAgents/BuildKiteTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void GetCurrentBranchShouldHandlePullRequests()
7272
var result = this.buildServer.GetCurrentBranch(false);
7373

7474
// Assert
75-
result.ShouldBe("refs/pull/55/head");
75+
result.ShouldBeNull();
7676
}
7777

7878
[Test]

src/GitVersion.Core.Tests/BuildAgents/CodeBuildTests.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,30 @@ private void AssertVariablesAreWrittenToFile(string file)
102102
props.ShouldContain("GitVersion_Major=1");
103103
props.ShouldContain("GitVersion_Minor=2");
104104
}
105+
106+
[Test]
107+
public void GetCurrentBranchShouldHandleTags()
108+
{
109+
// Arrange
110+
this.environment.SetEnvironmentVariable("CODEBUILD_WEBHOOK_HEAD_REF", "refs/tags/1.0.0");
111+
112+
// Act
113+
var result = this.buildServer.GetCurrentBranch(false);
114+
115+
// Assert
116+
result.ShouldBeNull();
117+
}
118+
119+
[Test]
120+
public void GetCurrentBranchShouldHandlePullRequests()
121+
{
122+
// Arrange
123+
this.environment.SetEnvironmentVariable("CODEBUILD_SOURCE_VERSION", "refs/pull/1/merge");
124+
125+
// Act
126+
var result = this.buildServer.GetCurrentBranch(false);
127+
128+
// Assert
129+
result.ShouldBeNull();
130+
}
105131
}

src/GitVersion.Core.Tests/BuildAgents/GitHubActionsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void GetCurrentBranchShouldHandleTags()
8383
var result = this.buildServer.GetCurrentBranch(false);
8484

8585
// Assert
86-
result.ShouldBe("refs/tags/1.0.0");
86+
result.ShouldBeNull();
8787
}
8888

8989
[Test]
@@ -96,7 +96,7 @@ public void GetCurrentBranchShouldHandlePullRequests()
9696
var result = this.buildServer.GetCurrentBranch(false);
9797

9898
// Assert
99-
result.ShouldBe("refs/pull/1/merge");
99+
result.ShouldBeNull();
100100
}
101101

102102
[Test]

src/GitVersion.Core.Tests/BuildAgents/SpaceAutomationTests.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
using GitVersion;
21
using GitVersion.BuildAgents;
32
using GitVersion.Core.Tests.Helpers;
43
using Microsoft.Extensions.DependencyInjection;
54
using NUnit.Framework;
65
using Shouldly;
76

8-
namespace GitVersionCore.Tests.BuildAgents;
7+
namespace GitVersion.Core.Tests.BuildAgents;
98

109
[TestFixture]
1110
public class SpaceAutomationTests : TestBase
@@ -71,7 +70,7 @@ public void GetCurrentBranchShouldHandleTags()
7170
var result = this.buildServer.GetCurrentBranch(false);
7271

7372
// Assert
74-
result.ShouldBe("refs/tags/1.0.0");
73+
result.ShouldBeNull();
7574
}
7675

7776
[Test]
@@ -84,7 +83,7 @@ public void GetCurrentBranchShouldHandlePullRequests()
8483
var result = this.buildServer.GetCurrentBranch(false);
8584

8685
// Assert
87-
result.ShouldBe("refs/pull/1/merge");
86+
result.ShouldBeNull();
8887
}
8988

9089
[Test]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using GitVersion.Configuration;
2+
using GitVersion.Core.Tests.Helpers;
3+
using GitVersion.Model.Configuration;
4+
using NUnit.Framework;
5+
using Shouldly;
6+
7+
namespace GitVersion.Core.Tests.Configuration;
8+
9+
[TestFixture]
10+
public class ConfigExtensionsTests : TestBase
11+
{
12+
[Test]
13+
public void GetReleaseBranchConfigReturnsAllReleaseBranches()
14+
{
15+
var config = new Config()
16+
{
17+
Branches = new Dictionary<string, BranchConfig>
18+
{
19+
{ "foo", new BranchConfig { Name = "foo" } },
20+
{ "bar", new BranchConfig { Name = "bar", IsReleaseBranch = true } },
21+
{ "baz", new BranchConfig { Name = "baz", IsReleaseBranch = true } }
22+
}
23+
};
24+
25+
var result = config.GetReleaseBranchConfig();
26+
27+
result.Count.ShouldBe(2);
28+
result.ShouldNotContain(b => b.Key == "foo");
29+
}
30+
}

0 commit comments

Comments
 (0)