Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changelog #52

Merged
merged 31 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
18f0244
Started on a changelog
rasmus Dec 9, 2021
ec747b0
Merge branch 'develop' into github-changes
rasmus Dec 9, 2021
8b0778a
Add token
rasmus Dec 9, 2021
bbdbc5b
Add DateTimeOffset converter
rasmus Dec 9, 2021
bda7ff4
Handle null
rasmus Dec 9, 2021
de2ecdb
Fix GitHub compare
rasmus Dec 9, 2021
a9001e0
Add changelog to release
rasmus Dec 9, 2021
c6318c5
Merge branch 'develop' into github-changes
rasmus Aug 5, 2022
11d7352
Merge branch 'develop' into github-changes
rasmus Oct 6, 2022
5000bef
Merge branch 'develop' into github-changes
rasmus Dec 12, 2023
a1868ed
Merge branch 'develop' into github-changes
rasmus Dec 12, 2023
2718a15
Work a bit
rasmus Dec 12, 2023
02a4a8b
Merge branch 'develop' into github-changes
rasmus Dec 20, 2023
22714e4
Get pull requests
rasmus Dec 20, 2023
462f847
Started on calculating the change log
rasmus Dec 20, 2023
5291f60
More
rasmus Dec 20, 2023
7f8bca7
Simpler changelog
rasmus Dec 20, 2023
be27274
Minor
rasmus Dec 20, 2023
58fe21f
Merge branch 'develop' into github-changes
rasmus Jan 5, 2024
94f6fbb
All bumps parsed
rasmus Jan 6, 2024
e61dd71
Merge branch 'github-changes' of github.com:rasmus/Bake into github-c…
rasmus Jan 6, 2024
6252b3f
Minor changes
rasmus Jan 6, 2024
b1d9d1f
Build change log
rasmus Jan 6, 2024
b675b95
A few SemVer fixes
rasmus Jan 6, 2024
a6f6710
Merge branch 'develop' into github-changes
rasmus Jan 8, 2024
a4fa6f7
Updated release notes
rasmus Jan 8, 2024
82988de
Print authors of PRs
rasmus Jan 8, 2024
a4c8e74
Merge branch 'github-changes' of github.com:rasmus/Bake into github-c…
rasmus Jan 8, 2024
42d5de9
Actually verify
rasmus Jan 9, 2024
ece929d
Update the readme
rasmus Jan 9, 2024
1b85fbb
Minor cleanups
rasmus Jan 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ regarding the environment its executed within.
* **GitHub Action** - When Bake is executed from within a GitHub action, it
automatically recognizes the token and uses that when publishing artifacts
and releases
* **Release notes** - If the repository contains a `RELEASE_NOTES.md` file,
the content as well as the version information is used to further enrich
any release artifacts
* **Release notes** - Pull requests merged since latest release are summarized,
similar grouped together, used as release notes. In addition, if the repository
contains a `RELEASE_NOTES.md` file, the content as well as the version information
is used to further enrich any release artifacts

After the initial environment information gathering is completed, Bake starts
to scan the repository for files and structures it knows how to process.
Expand Down
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 0.22-beta

* New: GitHub releases now have a description that contains the a summary
of all pull requests and issues that are part of the release
* Fixed: Cleanup of the artifact post run report

# 0.21-beta
Expand Down
117 changes: 117 additions & 0 deletions Source/Bake.Tests/ExplicitTests/GitHubTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// MIT License
//
// Copyright (c) 2021-2023 Rasmus Mikkelsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Bake.Cooking.Cooks.GitHub;
using Bake.Core;
using Bake.Services;
using Bake.Tests.Helpers;
using Bake.ValueObjects;
using FluentAssertions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;

namespace Bake.Tests.ExplicitTests
{
[Explicit]
public class GitHubTests : ServiceTest<GitHub>
{
public GitHubTests() : base(null) { }

[Test]
public async Task GetCommits()
{
var commits = await Sut.GetCommitsAsync(
"e1b486d",
"c54a03b",
new GitHubInformation(
"rasmus",
"Bake",
new Uri("https://github.com/rasmus/Bake"),
new Uri("https://api.github.com/")),
CancellationToken.None);
}

[Test]
public async Task GetPullRequests()
{
var pullRequests = await Sut.GetPullRequestsAsync(
"e1b486d",
"c54a03b",
new GitHubInformation(
"rasmus",
"Bake",
new Uri("https://github.com/rasmus/Bake"),
new Uri("https://api.github.com/")),
CancellationToken.None);

foreach (var pullRequest in pullRequests)
{
Console.WriteLine($"new ({pullRequest.Number}, \"{pullRequest.Title}\", new []{{\"{pullRequest.Authors.Single()}\"}}),");
}
}

[Test]
public async Task GetPullRequest_NonExisting()
{
// Act
var pullRequest = await Sut.GetPullRequestAsync(
new GitHubInformation(
"rasmus",
"Bake",
new Uri("https://github.com/rasmus/Bake"),
new Uri("https://api.github.com/")),
int.MaxValue,
CancellationToken.None);

// Assert
pullRequest.Should().BeNull();
}

private static string GetToken()
{
return new ConfigurationBuilder()
.AddUserSecrets<GitHubReleaseCookTests>()
.Build()["github:token"];
}

protected override IServiceCollection Configure(IServiceCollection serviceCollection)
{
return base.Configure(serviceCollection)
.AddSingleton<GitHub>()
.AddSingleton<IGitHubClientFactory, GitHubClientFactory>()
.AddSingleton<ICredentials, Credentials>()
.AddSingleton<GitHubReleaseCook>()
.AddSingleton<IDefaults, Defaults>()
.AddSingleton<IFileSystem, FileSystem>()
.AddSingleton<IEnvironmentVariables>(new TestEnvironmentVariables(new Dictionary<string, string>
{
["github_personal_token"] = GetToken(),
}));
}
}
}
41 changes: 39 additions & 2 deletions Source/Bake.Tests/Helpers/BakeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;

// ReSharper disable StringLiteralTypo

namespace Bake.Tests.Helpers
{
public abstract class BakeTest : TestProject
Expand Down Expand Up @@ -126,13 +128,48 @@ public Task CreateReleaseAsync(
return Task.CompletedTask;
}

public Task<PullRequestInformation> GetPullRequestInformationAsync(
GitInformation gitInformation,
public Task<PullRequestInformation?> GetPullRequestInformationAsync(GitInformation gitInformation,
GitHubInformation gitHubInformation,
CancellationToken cancellationToken)
{
return Task.FromResult<PullRequestInformation>(null);
}

public Task<IReadOnlyCollection<Commit>> GetCommitsAsync(string baseSha, string headSha,
GitHubInformation gitHubInformation,
CancellationToken cancellationToken)
{
var commits = new List<Commit>
{
new("Wrote some awesome tests", "c2dbe6e", DateTimeOffset.Now, new Author("Rasmus Mikkelsen", "[email protected]")),
new("Got it working", "4d79e4e", DateTimeOffset.Now, new Author("Rasmus Mikkelsen", "[email protected]"))
};

return Task.FromResult<IReadOnlyCollection<Commit>>(commits);
}

public Task<IReadOnlyCollection<PullRequest>> GetPullRequestsAsync(string baseSha,
string headSha,
GitHubInformation gitHubInformation,
CancellationToken cancellationToken)
{
throw new NotImplementedException();
}

public Task<PullRequest> GetPullRequestAsync(
GitHubInformation gitHubInformation,
int number,
CancellationToken cancellationToken)
{
throw new NotImplementedException();
}

public Task<IReadOnlyCollection<Tag>> GetTagsAsync(
GitHubInformation gitHubInformation,
CancellationToken cancellationToken)
{
return Task.FromResult<IReadOnlyCollection<Tag>>(Array.Empty<Tag>());
}
}
}
}
12 changes: 9 additions & 3 deletions Source/Bake.Tests/UnitTests/Core/SemVerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public class SemVerTests
2,
null,
null)]
[TestCase(
"3",
3,
null,
null,
null)]
[TestCase(
"1.2.3-meta",
1,
Expand Down Expand Up @@ -62,12 +68,12 @@ public class SemVerTests
public void ValidVersions(
string str,
int expectedMajor,
int expectedMinor,
int? expectedMinor,
int? expectedPatch,
string expectedMeta)
{
// Act
var version = SemVer.Parse(str);
var version = SemVer.Parse(str, true);

// Assert
version.Major.Should().Be(expectedMajor);
Expand Down Expand Up @@ -117,7 +123,7 @@ public void Compare(
{
// Act
var list = versions
.Select(SemVer.Parse)
.Select(s => SemVer.Parse(s))
.OrderBy(v => v);

// Assert
Expand Down
134 changes: 134 additions & 0 deletions Source/Bake.Tests/UnitTests/Services/ChangeLogBuilderTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
// MIT License
//
// Copyright (c) 2021-2023 Rasmus Mikkelsen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using System.Collections.Generic;
using System.Linq;
using Bake.Services;
using Bake.Tests.Helpers;
using Bake.ValueObjects;
using FluentAssertions;
using NUnit.Framework;

namespace Bake.Tests.UnitTests.Services
{
public class ChangeLogBuilderTests : TestFor<ChangeLogBuilder>
{
[Test]
public void Build()
{
// Arrange
var pullRequests = Get();

// Act
var changes = Sut.Build(pullRequests);

// Assert
changes.Should().HaveCount(2);
changes[ChangeType.Dependency].Should().HaveCount(21);
changes[ChangeType.Dependency].Select(d => d.Text).Should().Contain("Bump flask 2.3.2 to 3.0.0 in /TestProjects/Python3.Flask (#265, #282, by @dependabot)");
}

private static IReadOnlyCollection<PullRequest> Get()
{
return new PullRequest[]
{
new (236, "Bump NuGet.Packaging from 6.6.0 to 6.6.1", new []{"dependabot"}),
new (235, "Post release fixes", new []{"rasmus"}),
new (237, "Bump YamlDotNet from 13.1.0 to 13.1.1", new []{"dependabot"}),
new (240, "Bump WireMock.Net from 1.5.28 to 1.5.29", new []{"dependabot"}),
new (241, "Bump semver from 7.5.1 to 7.5.3 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (239, "Bump Octokit from 6.0.0 to 6.1.0", new []{"dependabot"}),
new (242, "Bump WireMock.Net from 1.5.29 to 1.5.30", new []{"dependabot"}),
new (243, "Bump Microsoft.NET.Test.Sdk from 17.6.2 to 17.6.3", new []{"dependabot"}),
new (244, "Bump Octokit from 6.1.0 to 6.2.1", new []{"dependabot"}),
new (246, "Bump fastify from 4.18.0 to 4.19.1 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (248, "Bump fastify from 4.19.1 to 4.19.2 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (247, "Bump Octokit from 6.2.1 to 7.0.0", new []{"dependabot"}),
new (249, "Bump Octokit from 7.0.0 to 7.0.1", new []{"dependabot"}),
new (250, "Bump WireMock.Net from 1.5.30 to 1.5.31", new []{"dependabot"}),
new (252, "Bump github.com/labstack/echo/v4 from 4.10.2 to 4.11.1 in /TestProjects/GoLang.Service", new []{"dependabot"}),
new (254, "Bump fastify from 4.19.2 to 4.20.0 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (255, "Bump Octokit from 7.0.1 to 7.1.0", new []{"dependabot"}),
new (253, "Bump WireMock.Net from 1.5.31 to 1.5.32", new []{"dependabot"}),
new (256, "Bump fastify from 4.20.0 to 4.21.0 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (259, "Bump Microsoft.NET.Test.Sdk from 17.6.3 to 17.7.0", new []{"dependabot"}),
new (258, "Bump WireMock.Net from 1.5.32 to 1.5.34", new []{"dependabot"}),
new (260, "Remove moq", new []{"rasmus"}),
new (261, "Bump NuGet.Packaging from 6.6.1 to 6.7.0", new []{"dependabot"}),
new (262, "Bump YamlDotNet from 13.1.1 to 13.2.0", new []{"dependabot"}),
new (263, "Bump Microsoft.NET.Test.Sdk from 17.7.0 to 17.7.1", new []{"dependabot"}),
new (264, "Bump WireMock.Net from 1.5.34 to 1.5.35", new []{"dependabot"}),
new (265, "Bump flask from 2.3.2 to 2.3.3 in /TestProjects/Python3.Flask", new []{"dependabot"}),
new (266, "Bump FluentAssertions from 6.11.0 to 6.12.0", new []{"dependabot"}),
new (267, "Bump fastify from 4.21.0 to 4.22.0 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (269, "Bump YamlDotNet from 13.2.0 to 13.3.1", new []{"dependabot"}),
new (268, "Bump McMaster.Extensions.CommandLineUtils from 4.0.2 to 4.1.0", new []{"dependabot"}),
new (270, "Bump Microsoft.NET.Test.Sdk from 17.7.1 to 17.7.2", new []{"dependabot"}),
new (271, "Bump fastify from 4.22.0 to 4.22.1 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (272, "Bump fastify from 4.22.1 to 4.22.2 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (275, "Bump fastify from 4.22.2 to 4.23.0 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (276, "Bump fastify from 4.23.0 to 4.23.1 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (277, "Bump fastify from 4.23.1 to 4.23.2 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (278, "Bump YamlDotNet from 13.3.1 to 13.4.0", new []{"dependabot"}),
new (279, "Bump WireMock.Net from 1.5.35 to 1.5.36", new []{"dependabot"}),
new (281, "Bump WireMock.Net from 1.5.36 to 1.5.37", new []{"dependabot"}),
new (284, "Bump YamlDotNet from 13.4.0 to 13.5.1", new []{"dependabot"}),
new (285, "Bump YamlDotNet from 13.5.1 to 13.5.2", new []{"dependabot"}),
new (286, "Bump WireMock.Net from 1.5.37 to 1.5.39", new []{"dependabot"}),
new (287, "Bump YamlDotNet from 13.5.2 to 13.7.0", new []{"dependabot"}),
new (288, "Bump github.com/labstack/echo/v4 from 4.11.1 to 4.11.2 in /TestProjects/GoLang.Service", new []{"dependabot"}),
new (289, "Bump fastify from 4.23.2 to 4.24.0 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (291, "Bump fastify from 4.24.0 to 4.24.2 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (293, "Bump fastify from 4.24.2 to 4.24.3 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (294, "Bump actions/setup-node from 3 to 4", new []{"dependabot"}),
new (292, "Bump YamlDotNet from 13.7.0 to 13.7.1", new []{"dependabot"}),
new (282, "Bump flask from 2.3.3 to 3.0.0 in /TestProjects/Python3.Flask", new []{"dependabot"}),
new (296, "Bump LibGit2Sharp from 0.27.2 to 0.28.0", new []{"dependabot"}),
new (297, "Bump NUnit from 3.13.3 to 3.14.0", new []{"dependabot"}),
new (273, "Bump actions/checkout from 3 to 4", new []{"dependabot"}),
new (298, "Bump github.com/labstack/echo/v4 from 4.11.2 to 4.11.3 in /TestProjects/GoLang.Service", new []{"dependabot"}),
new (299, "Bump WireMock.Net from 1.5.39 to 1.5.40", new []{"dependabot"}),
new (300, "Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0", new []{"dependabot"}),
new (308, "Update and test .NET 8", new []{"rasmus"}),
new (309, "Bump NuGet.Packaging from 6.7.0 to 6.8.0", new []{"dependabot"}),
new (311, "Bump actions/setup-dotnet from 3 to 4", new []{"dependabot"}),
new (313, "Bump actions/setup-go from 4 to 5", new []{"dependabot"}),
new (314, "Bump WireMock.Net from 1.5.40 to 1.5.42", new []{"dependabot"}),
new (315, "Bump LibGit2Sharp from 0.28.0 to 0.29.0", new []{"dependabot"}),
new (316, "Bump AutoFixture.AutoNSubstitute from 4.18.0 to 4.18.1", new []{"dependabot"}),
new (318, "Bump WireMock.Net from 1.5.42 to 1.5.43", new []{"dependabot"}),
new (312, "Bump actions/setup-python from 4 to 5", new []{"dependabot"}),
new (319, "Don't print commands", new []{"rasmus"}),
new (321, "Bump fastify from 4.24.3 to 4.25.0 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (323, "Bump WireMock.Net from 1.5.43 to 1.5.44", new []{"dependabot"}),
new (325, "Bump fastify from 4.25.0 to 4.25.1 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (326, "Bump golang.org/x/crypto from 0.14.0 to 0.17.0 in /TestProjects/GoLang.Service", new []{"dependabot"}),
new (322, "Bump github/codeql-action from 2 to 3", new []{"dependabot"}),
new (317, "Bump NUnit from 3.14.0 to 4.0.1", new []{"dependabot"}),
new (327, "Bump github.com/labstack/echo/v4 from 4.11.3 to 4.11.4 in /TestProjects/GoLang.Service", new []{"dependabot"}),
new (328, "Bump WireMock.Net from 1.5.44 to 1.5.45", new []{"dependabot"}),
new (329, "Bump fastify from 4.25.1 to 4.25.2 in /TestProjects/NodeJS.Service", new []{"dependabot"}),
new (330, "Bump WireMock.Net from 1.5.45 to 1.5.46", new []{"dependabot"}),
};
}
}
}
Loading
Loading