Skip to content

Commit e425dc5

Browse files
authored
Merge branch 'master' into feature/dynamic-tag-evaluation
2 parents 9efe58a + fdc6957 commit e425dc5

File tree

69 files changed

+417
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+417
-126
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"cake.tool": {
6-
"version": "0.37.0",
6+
"version": "0.38.5",
77
"commands": [
88
"dotnet-cake"
99
]

.github/workflows/format.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
name: Validate PR
1+
name: Validate Commit
22

3-
on: [pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'fix/*'
8+
- 'feature/*'
9+
10+
pull_request:
11+
branches:
12+
- master
413

514
jobs:
615
format:
716
runs-on: ubuntu-latest
817
name: DotNet Format
918
steps:
1019
- uses: actions/checkout@v2
11-
12-
# workaround for dotnet tools not being on path https://github.com/actions/virtual-environments/issues/213
13-
- name: add .dotnet/tools to path
14-
run: echo "::set-env name=PATH::${PATH}:${HOME}/.dotnet/tools"
15-
1620
- run: dotnet tool install -g dotnet-format
17-
1821
- run: dotnet format ./ --folder --check --exclude **/AddFormats/

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ from The Noun Project.
8888
[dockerhub]: https://hub.docker.com/r/gittools/gitversion/
8989
[dockerhub-badge]: https://img.shields.io/docker/pulls/gittools/gitversion.svg?logo=docker
9090
[az-pipeline-task]: https://marketplace.visualstudio.com/items?itemName=gittools.gittools
91-
[az-pipeline-task-badge]: https://img.shields.io/badge/marketplace-gittools.gittools-blue?logo=visual-studio
92-
[gh-actions]: https://github.com/marketplace/actions/use-actions
93-
[gh-actions-badge]: https://img.shields.io/badge/marketplace-use--actions-blue?logo=github
91+
[az-pipeline-task-badge]: https://img.shields.io/badge/marketplace-gittools.gittools-blue?logo=azure-pipelines
92+
[gh-actions]: https://github.com/marketplace/actions/gittools
93+
[gh-actions-badge]: https://img.shields.io/badge/marketplace-gittools-blue?logo=github
9494
[contribute]: https://github.com/GitTools/GitVersion/blob/master/CONTRIBUTING.md
9595
[why]: https://gitversion.net/docs/why
9696
[usage]: https://gitversion.net/docs/usage/usage

build.cake

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22
#module nuget:?package=Cake.DotNetTool.Module&version=0.4.0
33

44
// Install addins.
5-
#addin "nuget:?package=Cake.Codecov&version=0.8.0"
5+
#addin "nuget:?package=Cake.Codecov&version=0.9.1"
66
#addin "nuget:?package=Cake.Compression&version=0.2.4"
7-
#addin "nuget:?package=Cake.Coverlet&version=2.4.2"
8-
#addin "nuget:?package=Cake.Docker&version=0.11.0"
9-
#addin "nuget:?package=Cake.Git&version=0.21.0"
7+
#addin "nuget:?package=Cake.Coverlet&version=2.5.1"
8+
#addin "nuget:?package=Cake.Docker&version=0.11.1"
9+
#addin "nuget:?package=Cake.Git&version=0.22.0"
1010
#addin "nuget:?package=Cake.Gitter&version=0.11.1"
1111
#addin "nuget:?package=Cake.Incubator&version=5.1.0"
12-
#addin "nuget:?package=Cake.Json&version=4.0.0"
13-
#addin "nuget:?package=Cake.Kudu&version=0.10.1"
12+
#addin "nuget:?package=Cake.Json&version=5.2.0"
13+
#addin "nuget:?package=Cake.Kudu&version=0.11.0"
1414
#addin "nuget:?package=Cake.Wyam&version=2.2.9"
1515

1616
#addin "nuget:?package=Newtonsoft.Json&version=12.0.3"
17-
#addin "nuget:?package=SharpZipLib&version=1.2.0"
17+
#addin "nuget:?package=SharpZipLib&version=1.3.0"
1818
#addin "nuget:?package=xunit.assert&version=2.4.1"
1919

2020
// Install tools.
2121
#tool "nuget:?package=NUnit.ConsoleRunner&version=3.11.1"
22-
#tool "nuget:?package=nuget.commandline&version=5.4.0"
22+
#tool "nuget:?package=nuget.commandline&version=5.7.0"
2323
#tool "nuget:?package=KuduSync.NET&version=1.5.3"
2424

2525
// Install .NET Core Global tools.
26-
#tool "dotnet:?package=Codecov.Tool&version=1.10.0"
27-
#tool "dotnet:?package=dotnet-format&version=3.3.111304"
26+
#tool "dotnet:?package=Codecov.Tool&version=1.12.3"
27+
#tool "dotnet:?package=dotnet-format&version=4.1.131201"
2828
#tool "dotnet:?package=GitReleaseManager.Tool&version=0.11.0"
2929
#tool "dotnet:?package=Wyam.Tool&version=2.2.9"
3030

build.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env bash
2-
DOTNET_VERSION=2.1.807,3.1.301
2+
DOTNET_VERSION=2.1.811,3.1.403

build/publish.cake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ Task("Publish-AzurePipeline")
3535
{
3636
foreach(var artifact in parameters.Artifacts.All)
3737
{
38-
if (FileExists(artifact.ArtifactPath)) { TFBuild.Commands.UploadArtifact("", artifact.ArtifactPath, "artifacts"); }
38+
if (FileExists(artifact.ArtifactPath)) { AzurePipelines.Commands.UploadArtifact("", artifact.ArtifactPath, "artifacts"); }
3939
}
4040
foreach(var package in parameters.Packages.All)
4141
{
42-
if (FileExists(package.PackagePath)) { TFBuild.Commands.UploadArtifact("", package.PackagePath, "packages"); }
42+
if (FileExists(package.PackagePath)) { AzurePipelines.Commands.UploadArtifact("", package.PackagePath, "packages"); }
4343
}
4444
})
4545
.OnError(exception =>

build/test.cake

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ Task("UnitTest")
3939
Exclude = new List<string> { "[GitVersion*.Tests]*", "[GitVersionTask.MsBuild]*" }
4040
};
4141

42-
if (IsRunningOnUnix() && string.Equals(framework, parameters.FullFxVersion48))
42+
if (string.Equals(framework, parameters.FullFxVersion48))
4343
{
44-
settings.Filter = "TestCategory!=NoMono";
44+
if (IsRunningOnUnix()) {
45+
settings.Filter = "TestCategory!=NoMono";
46+
} else {
47+
settings.Filter = "TestCategory!=NoNet48";
48+
}
4549
}
46-
50+
4751
DotNetCoreTest(project.FullPath, settings, coverletSettings);
4852
});
4953
}
@@ -69,12 +73,12 @@ Task("UnitTest")
6973
if (parameters.IsRunningOnAzurePipeline)
7074
{
7175
if (testResultsFiles.Any()) {
72-
var data = new TFBuildPublishTestResultsData {
76+
var data = new AzurePipelinesPublishTestResultsData {
7377
TestResultsFiles = testResultsFiles.ToArray(),
7478
Platform = Context.Environment.Platform.Family.ToString(),
75-
TestRunner = TFTestRunnerType.NUnit
79+
TestRunner = AzurePipelinesTestRunnerType.NUnit
7680
};
77-
TFBuild.Commands.PublishTestResults(data);
81+
AzurePipelines.Commands.PublishTestResults(data);
7882
}
7983
}
8084
});

build/utils/utils.cake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static bool IsOnMainRepo(this ICakeContext context)
2323
}
2424
else if (buildSystem.IsRunningOnAzurePipelines || buildSystem.IsRunningOnAzurePipelinesHosted)
2525
{
26-
repositoryName = buildSystem.TFBuild.Environment.Repository.RepoName;
26+
repositoryName = buildSystem.AzurePipelines.Environment.Repository.RepoName;
2727
}
2828
else if (buildSystem.IsRunningOnGitHubActions)
2929
{
@@ -49,7 +49,7 @@ public static bool IsOnMainBranch(this ICakeContext context)
4949
}
5050
else if (buildSystem.IsRunningOnAzurePipelines || buildSystem.IsRunningOnAzurePipelinesHosted)
5151
{
52-
repositoryBranch = buildSystem.TFBuild.Environment.Repository.SourceBranchName;
52+
repositoryBranch = buildSystem.AzurePipelines.Environment.Repository.SourceBranchName;
5353
}
5454
else if (buildSystem.IsRunningOnGitHubActions)
5555
{

docs/input/docs/build-server-support/build-server/bamboo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ a Windows build host using Powershell. The build only needs one of the two.
1919

2020
```bash
2121
~/.dotnet/tools/dotnet-gitversion > gitversion.txt
22-
sed -i '1d;26d;s/ //;s/"//g;s/,//;s/:/=/' gitversion.txt
22+
sed -i '1d;$ d;s/ //;s/"//g;s/,//;s/:/=/' gitversion.txt
2323
```
2424

2525
### Task: Script

docs/input/docs/more-info/variables.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ Running `GitVersion.exe` in your repo will show you what is available. For the
3939
"VersionSourceSha":"950d2f830f5a2af12a6779a48d20dcbb02351f25",
4040
"CommitsSinceVersionSource":1,
4141
"CommitsSinceVersionSourcePadded":"0001",
42-
"CommitDate":"2014-03-06"
42+
"CommitDate":"2014-03-06",
43+
"UncommittedChanges": 0
4344
}
4445
```
4546

src/Directory.Build.props

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@
1919

2020
</PropertyGroup>
2121
<PropertyGroup>
22-
<PackageVersion_LibGit2Sharp>0.27.0-preview-0034</PackageVersion_LibGit2Sharp>
23-
<PackageVersion_LibGit2Sharp_NativeBinaries>2.0.298</PackageVersion_LibGit2Sharp_NativeBinaries>
22+
<PackageVersion_LibGit2Sharp>0.27.0-preview-0096</PackageVersion_LibGit2Sharp>
23+
<PackageVersion_LibGit2Sharp_NativeBinaries>2.0.312</PackageVersion_LibGit2Sharp_NativeBinaries>
2424

2525
<PackageVersion_JetBrainsAnnotations>2020.1.0</PackageVersion_JetBrainsAnnotations>
2626
<PackageVersion_YamlDotNet>8.1.2</PackageVersion_YamlDotNet>
2727
<PackageVersion_NewtonsoftJson>12.0.3</PackageVersion_NewtonsoftJson>
2828
<PackageVersion_MicrosoftExtensions>3.0.0</PackageVersion_MicrosoftExtensions>
29-
<PackageVersion_MsBuild>16.7.0</PackageVersion_MsBuild>
29+
<PackageVersion_MsBuild>16.8.0</PackageVersion_MsBuild>
3030

31-
<PackageVersion_MicrosoftTestSdk>16.7.1</PackageVersion_MicrosoftTestSdk>
31+
<PackageVersion_MicrosoftTestSdk>16.8.0</PackageVersion_MicrosoftTestSdk>
3232
<PackageVersion_NSubstitute>4.2.2</PackageVersion_NSubstitute>
3333
<PackageVersion_CoverletMsBuild>2.9.0</PackageVersion_CoverletMsBuild>
3434
<PackageVersion_NUnit>3.12.0</PackageVersion_NUnit>
3535
<PackageVersion_GitToolsTesting>1.2.0</PackageVersion_GitToolsTesting>
3636
<PackageVersion_NUnit3TestAdapter>3.17.0</PackageVersion_NUnit3TestAdapter>
37-
<PackageVersion_NunitXmlTestLogger>2.1.62</PackageVersion_NunitXmlTestLogger>
38-
<PackageVersion_Shouldly>4.0.0-beta0002</PackageVersion_Shouldly>
37+
<PackageVersion_NunitXmlTestLogger>2.1.80</PackageVersion_NunitXmlTestLogger>
38+
<PackageVersion_Shouldly>4.0.1</PackageVersion_Shouldly>
3939

4040
</PropertyGroup>
4141

src/GitVersion.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ II.2.12 &lt;HandlesEvent /&gt;&#xD;
549549
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=5C63448180C9174C8C28A084F80E37DF/RelativePath/@EntryValue"></s:String>
550550
<s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File5C63448180C9174C8C28A084F80E37DF/@KeyIndexDefined">True</s:Boolean>
551551
<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File5C63448180C9174C8C28A084F80E37DF/RelativePriority/@EntryValue">1</s:Double>
552+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002EDaemon_002ESettings_002EMigration_002ESwaWarningsModeSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
552553
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
553554
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpFileLayoutPatternsUpgrade/@EntryIndexedValue">True</s:Boolean>
554555
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>

src/GitVersionCore.Tests/BuildAgents/BuildServerBaseTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void BuildNumberIsFullSemVer()
5353

5454
writes = new List<string>();
5555
buildServer.WriteIntegration(writes.Add, variables, false);
56-
writes.ShouldBeEmpty();
56+
writes.ShouldNotContain(x => x.StartsWith("Executing GenerateSetVersionMessage for "));
5757
}
5858

5959
private class BuildAgent : BuildAgentBase

src/GitVersionCore.Tests/BuildAgents/GitHubActionsTests.cs

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.IO;
23
using GitVersion;
34
using GitVersion.BuildAgents;
45
using GitVersionCore.Tests.Helpers;
@@ -15,6 +16,7 @@ public class GitHubActionsTests : TestBase
1516
{
1617
private IEnvironment environment;
1718
private GitHubActions buildServer;
19+
private string githubSetEnvironmentTempFilePath;
1820

1921
[SetUp]
2022
public void SetUp()
@@ -26,12 +28,21 @@ public void SetUp()
2628
environment = sp.GetService<IEnvironment>();
2729
buildServer = sp.GetService<GitHubActions>();
2830
environment.SetEnvironmentVariable(GitHubActions.EnvironmentVariableName, "true");
31+
32+
githubSetEnvironmentTempFilePath = Path.GetTempFileName();
33+
environment.SetEnvironmentVariable(GitHubActions.GitHubSetEnvTempFileEnvironmentVariableName, githubSetEnvironmentTempFilePath);
2934
}
3035

3136
[TearDown]
3237
public void TearDown()
3338
{
3439
environment.SetEnvironmentVariable(GitHubActions.EnvironmentVariableName, null);
40+
environment.SetEnvironmentVariable(GitHubActions.GitHubSetEnvTempFileEnvironmentVariableName, null);
41+
if (githubSetEnvironmentTempFilePath != null && File.Exists(githubSetEnvironmentTempFilePath))
42+
{
43+
File.Delete(githubSetEnvironmentTempFilePath);
44+
githubSetEnvironmentTempFilePath = null;
45+
}
3546
}
3647

3748
[Test]
@@ -96,19 +107,17 @@ public void GetCurrentBranchShouldHandlePullRequests()
96107
result.ShouldBe("refs/pull/1/merge");
97108
}
98109

99-
[TestCase("Something", "1.0.0",
100-
"\"GitVersion_Something=1.0.0\" >> $GITHUB_ENV")]
101-
public void GetSetParameterMessage(string key, string value, string expectedResult)
110+
[Test]
111+
public void GetSetParameterMessage()
102112
{
103113
// Assert
104114
environment.GetEnvironmentVariable("GitVersion_Something").ShouldBeNullOrWhiteSpace();
105115

106116
// Act
107-
var result = buildServer.GenerateSetParameterMessage(key, value);
117+
var result = buildServer.GenerateSetParameterMessage("GitVersion_Something", "1.0.0");
108118

109119
// Assert
110-
result.ShouldContain(s => true, 1);
111-
result.ShouldBeEquivalentTo(new[] { expectedResult });
120+
result.ShouldContain(s => true, 0);
112121
}
113122

114123
[Test]
@@ -141,11 +150,20 @@ public void ShouldWriteIntegration()
141150
"Executing GenerateSetVersionMessage for 'GitHubActions'.",
142151
"",
143152
"Executing GenerateBuildLogOutput for 'GitHubActions'.",
144-
"\"GitVersion_Major=1.0.0\" >> $GITHUB_ENV"
153+
"Writing version variables to $GITHUB_ENV file for 'GitHubActions'."
145154
};
146155

147156
string.Join(Environment.NewLine, list)
148157
.ShouldBe(string.Join(Environment.NewLine, expected));
158+
159+
var expectedFileContents = new List<string>
160+
{
161+
"GitVersion_Major=1.0.0"
162+
};
163+
164+
var actualFileContents = File.ReadAllLines(githubSetEnvironmentTempFilePath);
165+
166+
actualFileContents.ShouldBe(expectedFileContents);
149167
}
150168

151169
[Test]
@@ -162,7 +180,7 @@ public void ShouldNotWriteIntegration()
162180
// Act
163181
buildServer.WriteIntegration(s => { list.Add(s); }, vars, false);
164182

165-
list.ShouldBeEmpty();
183+
list.ShouldNotContain(x => x.StartsWith("Executing GenerateSetVersionMessage for "));
166184
}
167185

168186
[Test]

src/GitVersionCore.Tests/Configuration/ConfigProviderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ public void NextVersionCanHavePatch()
198198

199199
[Test]
200200
[MethodImpl(MethodImplOptions.NoInlining)]
201-
[Category("NoMono")]
202-
[Description("Won't run on Mono due to source information not being available for ShouldMatchApproved.")]
201+
[Category(NoMono)]
202+
[Description(NoMonoDescription)]
203203
public void CanWriteOutEffectiveConfiguration()
204204
{
205205
var config = configProvider.Provide(repoPath);

src/GitVersionCore.Tests/Configuration/IgnoreConfigTests.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
using System;
22
using System.IO;
33
using GitVersion.Configuration;
4+
using GitVersion.Model.Configuration;
45
using GitVersionCore.Tests.Helpers;
56
using NUnit.Framework;
67
using Shouldly;
78
using YamlDotNet.Core;
89

910
namespace GitVersionCore.Tests.Configuration
1011
{
12+
1113
[TestFixture]
1214
public class IgnoreConfigTests : TestBase
1315
{
@@ -34,7 +36,7 @@ public void ShouldSupportsOtherSequenceFormat()
3436
{
3537
var yaml = @"
3638
ignore:
37-
sha:
39+
sha:
3840
- b6c0c9fda88830ebcd563e500a5a7da5a1658e98
3941
- 6c19c7c219ecf8dbc468042baefa73a1b213e8b1
4042
";
@@ -59,7 +61,7 @@ public void WhenNotInConfigShouldHaveDefaults()
5961

6062
config.Ignore.ShouldNotBeNull();
6163
config.Ignore.ShAs.ShouldBeEmpty();
62-
config.Ignore.Before.ShouldBeNull();
64+
config.Ignore.Before.ShouldBe(null);
6365
}
6466

6567
[Test]
@@ -73,5 +75,13 @@ public void WhenBadDateFormatShouldFail()
7375
using var reader = new StringReader(yaml);
7476
Should.Throw<YamlException>(() => ConfigSerializer.Read(reader));
7577
}
78+
79+
[Test]
80+
public void NewInstanceShouldBeEmpty()
81+
{
82+
var ignoreConfig = new IgnoreConfig();
83+
84+
ignoreConfig.IsEmpty.ShouldBeTrue();
85+
}
7686
}
7787
}

src/GitVersionCore.Tests/Configuration/Init/InitScenarios.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public void Setup()
2121
}
2222

2323
[Test]
24-
[Category("NoMono")]
25-
[Description("Won't run on Mono due to source information not being available for ShouldMatchApproved.")]
24+
[Category(NoMono)]
25+
[Description(NoMonoDescription)]
2626
public void CanSetNextVersion()
2727
{
2828
var workingDirectory = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "c:\\proj" : "/proj";

0 commit comments

Comments
 (0)