Skip to content

Commit

Permalink
Merge branch 'release/0.14.0'
Browse files Browse the repository at this point in the history
* release/0.14.0: (28 commits)
  (maint) Consolidate and remove duplicates
  (maint) Update PackageReference
  (maint) Update PackageReference
  Bump Serilog.Sinks.Console from 4.0.1 to 4.1.0 in /src
  Bump Shouldly from 4.0.3 to 4.2.1 in /src
  Bump Microsoft.Extensions.DependencyInjection in /src
  Bump TextCopy from 6.1.0 to 6.2.1 in /src
  Bump Microsoft.CodeAnalysis.NetAnalyzers from 6.0.0 to 7.0.3 in /src
  Bump NSubstitute from 4.3.0 to 5.0.0 in /src
  Bump Microsoft.NET.Test.Sdk from 17.0.0 to 17.7.1 in /src
  Bump Scriban from 5.0.0 to 5.7.0 in /src
  Bump IDisposableAnalyzers from 4.0.1 to 4.0.6 in /src
  Bump NUnit from 3.13.2 to 3.13.3 in /src
  Bump CommandLineParser from 2.8.0 to 2.9.1 in /src
  Bump coverlet.msbuild from 3.1.1 to 6.0.0 in /src
  Bump Roslynator.Analyzers from 4.0.2 to 4.4.0 in /src
  Bump ApprovalTests from 5.7.1 to 5.8.0 in /src
  (#454) Create test
  (#454) Fix NullReferenceException on release not found
  (build) Force building of 0.14.0
  ...
  • Loading branch information
gep13 committed Aug 22, 2023
2 parents 9d82f41 + 48b6fc1 commit dd68f2f
Show file tree
Hide file tree
Showing 18 changed files with 99 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "0.38.5",
"version": "1.3.0",
"commands": [
"dotnet-cake"
]
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ jobs:
- name: Fetch all tags and branches
run: git fetch --prune --unshallow

- name: Install .NET SDK 3.1.x and 5.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.0.x
- name: Cache Tools
uses: actions/cache@v2
with:
Expand All @@ -38,8 +45,7 @@ jobs:
script-path: recipe.cake
target: CI
verbosity: Normal
cake-version: 0.38.5
cake-bootstrap: true
cake-version: tool-manifest

- name: Upload Issues-Report
uses: actions/upload-artifact@v2
Expand Down
1 change: 0 additions & 1 deletion cake.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

[Nuget]
Source=https://api.nuget.org/v3/index.json
UseInProcessClient=true

[Paths]
Tools=./tools
Expand Down
1 change: 1 addition & 0 deletions gitversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
next-version: 0.14.0
9 changes: 1 addition & 8 deletions recipe.cake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#load nuget:?package=Cake.Recipe&version=2.2.1
#load nuget:?package=Cake.Recipe&version=3.0.1
#tool dotnet:?package=dotnet-t4&version=2.2.1

Environment.SetVariableNames(githubTokenVariable: "GITTOOLS_GITHUB_TOKEN");
Expand All @@ -14,7 +14,6 @@ BuildParameters.SetParameters(context: Context,
appVeyorAccountName: "GitTools",
shouldRunDotNetCorePack: true,
shouldRunIntegrationTests: true,
shouldRunDupFinder: false,
integrationTestScriptPath: "./tests/integration/tests.cake",
twitterMessage: standardNotificationMessage,
gitterMessage: "@/all " + standardNotificationMessage);
Expand All @@ -24,12 +23,6 @@ BuildParameters.PackageSources.Add(new PackageSourceData(Context, "GPR", "https:
BuildParameters.PrintParameters(Context);

ToolSettings.SetToolSettings(context: Context,
dupFinderExcludePattern: new string[] {
BuildParameters.RootDirectoryPath + "/src/GitReleaseManager.Core.Tests/**/*.cs",
BuildParameters.RootDirectoryPath + "/src/GitReleaseManager.Tests/**/*.cs",
BuildParameters.RootDirectoryPath + "/src/GitReleaseManager.IntegrationTests/**/*.cs",
BuildParameters.RootDirectoryPath + "/src/GitReleaseManager/AutoMapperConfiguration.cs",
"**/*.AssemblyInfo.cs" },
testCoverageFilter: "+[GitReleaseManager*]* -[GitReleaseManager.Core.Tests*]* -[GitReleaseManager.Tests*]*",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Expand Down
6 changes: 3 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="IDisposableAnalyzers" Version="4.0.1">
<PackageReference Include="IDisposableAnalyzers" Version="4.0.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Roslynator.Analyzers" Version="4.0.2">
<PackageReference Include="Roslynator.Analyzers" Version="4.4.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/GitReleaseManager.Cli/GitReleaseManager.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
<ProjectReference Include="..\GitReleaseManager.Core\GitReleaseManager.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Destructurama.Attributed" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Destructurama.Attributed" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Octokit" Version="0.50.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="seriloganalyzer" Version="0.15.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LangVersion>8.0</LangVersion>
<TargetFrameworks>net472;netcoreapp3.1;net6.0</TargetFrameworks>
Expand All @@ -13,22 +13,20 @@
<ProjectReference Include="..\GitReleaseManager.Core\GitReleaseManager.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.1.1">
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="ApprovalTests" Version="5.7.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="ApprovalTests" Version="5.7.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="ApprovalTests" Version="5.8.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NSubstitute" Version="4.3.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NSubstitute" Version="5.0.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Octokit" Version="0.50.0" />
<PackageReference Include="Shouldly" Version="4.0.3" />
<PackageReference Include="Shouldly" Version="4.2.1" />
</ItemGroup>
</Project>
39 changes: 39 additions & 0 deletions src/GitReleaseManager.Core.Tests/VcsServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,45 @@ await _vcsProvider.Received(1).CreateReleaseAsync(OWNER, REPOSITORY, Arg.Is<Rele
_logger.Received(1).Debug(Arg.Any<string>(), Arg.Any<Release>());
}

[Test]
public async Task Should_Create_Release_From_Milestone_With_Assets()
{
var release = new Release { Assets = new List<ReleaseAsset>() };

var assetsCount = _assets.Count;

_releaseNotesBuilder.BuildReleaseNotes(OWNER, REPOSITORY, MILESTONE_TITLE, ReleaseTemplates.DEFAULT_NAME)
.Returns(Task.FromResult(RELEASE_NOTES));

_vcsProvider.GetReleaseAsync(OWNER, REPOSITORY, MILESTONE_TITLE)
.Returns(Task.FromResult<Release>(null));

_vcsProvider.CreateReleaseAsync(OWNER, REPOSITORY, Arg.Any<Release>())
.Returns(Task.FromResult(release));

var result = await _vcsService.CreateReleaseFromMilestoneAsync(
OWNER,
REPOSITORY,
MILESTONE_TITLE,
MILESTONE_TITLE,
null,
_assets,
false,
null
).ConfigureAwait(false);
result.ShouldBeSameAs(release);

await _releaseNotesBuilder.Received(1).BuildReleaseNotes(OWNER, REPOSITORY, MILESTONE_TITLE, ReleaseTemplates.DEFAULT_NAME).ConfigureAwait(false);
await _vcsProvider.Received(1).GetReleaseAsync(OWNER, REPOSITORY, MILESTONE_TITLE).ConfigureAwait(false);
await _vcsProvider.Received(1).CreateReleaseAsync(OWNER, REPOSITORY, Arg.Is<Release>(o =>
o.Body == RELEASE_NOTES &&
o.Name == MILESTONE_TITLE &&
o.TagName == MILESTONE_TITLE)).ConfigureAwait(false);

_logger.Received(1).Verbose(Arg.Any<string>(), MILESTONE_TITLE, OWNER, REPOSITORY);
_logger.Received(1).Debug(Arg.Any<string>(), Arg.Any<Release>());
}

[Test]
public async Task Should_Create_Release_From_Milestone_Using_Template_File()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ private static void SetConfigurationSamples(object config, Type configType, Text
{
property.SetValue(config, null);
}

continue;
}
else if (yamlMemberAttribute.DefaultValuesHandling == DefaultValuesHandling.OmitNull)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public InvalidIssuesException(List<string> errors, string message, Exception inn
protected InvalidIssuesException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context)
: base(info, context) { }
: base(info, context)
{
}
}
}
2 changes: 2 additions & 0 deletions src/GitReleaseManager.Core/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ internal static class StringExtensions
{
public static string ReplaceMilestoneTitle(this string source, string milestoneKey, string milestoneTitle)
{
#pragma warning disable SA1001 // Commas should be spaced correctly
var dict = new Dictionary<string, object>
{
{ milestoneKey.Trim('{','}'), milestoneTitle },
};
#pragma warning restore SA1001 // Commas should be spaced correctly

return source.ReplaceTemplate(dict);
}
Expand Down
6 changes: 3 additions & 3 deletions src/GitReleaseManager.Core/GitReleaseManager.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Destructurama.Attributed" Version="3.0.0" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Destructurama.Attributed" Version="3.1.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Octokit" Version="0.50.0" />
<PackageReference Include="Scriban" Version="5.0.0" />
<PackageReference Include="Scriban" Version="5.7.0" />
<PackageReference Include="seriloganalyzer" Version="0.15.0" />
<PackageReference Include="YamlDotNet" Version="11.2.1" />
<PackageReference Include="AutoMapper" Version="10.1.1" />
Expand Down
8 changes: 5 additions & 3 deletions src/GitReleaseManager.Core/VcsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private async Task<Release> CreateReleaseAsync(string owner, string repository,
await _vcsProvider.UpdateReleaseAsync(owner, repository, release).ConfigureAwait(false);
}

await AddAssetsAsync(owner, repository, tagName, assets).ConfigureAwait(false);
await AddAssetsAsync(owner, repository, tagName, assets, release).ConfigureAwait(false);

return release;
}
Expand All @@ -127,13 +127,15 @@ public async Task DiscardReleaseAsync(string owner, string repository, string ta
}
}

public async Task AddAssetsAsync(string owner, string repository, string tagName, IList<string> assets)
public async Task AddAssetsAsync(string owner, string repository, string tagName, IList<string> assets) => await AddAssetsAsync(owner, repository, tagName, assets, null);

private async Task AddAssetsAsync(string owner, string repository, string tagName, IList<string> assets, Release currentRelease)
{
if (assets?.Any() == true)
{
try
{
var release = await _vcsProvider.GetReleaseAsync(owner, repository, tagName).ConfigureAwait(false);
var release = currentRelease ?? await _vcsProvider.GetReleaseAsync(owner, repository, tagName).ConfigureAwait(false);

foreach (var asset in assets)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LangVersion>8.0</LangVersion>
<TargetFrameworks>net472;netcoreapp3.1;net6.0</TargetFrameworks>
Expand All @@ -13,19 +13,19 @@
<ProjectReference Include="..\GitReleaseManager.Core\GitReleaseManager.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.1.1">
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Shouldly" Version="4.0.3" />
<PackageReference Include="TextCopy" Version="6.1.0" />
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="TextCopy" Version="6.2.1" />
</ItemGroup>
</Project>
14 changes: 6 additions & 8 deletions src/GitReleaseManager.Tests/GitReleaseManager.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@
<ProjectReference Include="..\GitReleaseManager.Core\GitReleaseManager.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.1.1">
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="ApprovalTests" Version="5.7.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="ApprovalTests" Version="5.7.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="ApprovalTests" Version="5.8.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NSubstitute" Version="4.3.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NSubstitute" Version="5.0.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Octokit" Version="0.50.0" />
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions src/GitReleaseManager.Tool/GitReleaseManager.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
<ProjectReference Include="..\GitReleaseManager.Core\GitReleaseManager.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Destructurama.Attributed" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Destructurama.Attributed" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Octokit" Version="0.50.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="seriloganalyzer" Version="0.15.0" />
Expand Down
4 changes: 2 additions & 2 deletions src/GitReleaseManager.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.181
# Visual Studio Version 17
VisualStudioVersion = 17.6.33801.468
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitReleaseManager.Tests", "GitReleaseManager.Tests\GitReleaseManager.Tests.csproj", "{FAD045A3-CF63-48CA-BA49-8F4D79E3EF4F}"
EndProject
Expand Down

0 comments on commit dd68f2f

Please sign in to comment.