Skip to content

Commit

Permalink
fix: Correct handling of absent github releases to generage changelogs.
Browse files Browse the repository at this point in the history
  • Loading branch information
hennadiilu authored Mar 8, 2024
1 parent 4947b80 commit db9efbb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ https://www.nuget.org/packages/Heleonix.Build

## The main idea

This framework is developed to simplify writing scripts to build applications on CI/CD systems like GoCD, Jenkins, TeamCity etc.
This framework is developed to simplify creation of scripts to build applications on CI/CD systems like GoCD, Jenkins, TeamCity etc.

The framework provides parameterized targets such as Hx_NetBuild, Hx_Coverlet, Hx_NetTest, Hx_Validate etc., which represent separate steps in CI pipelines.
The framework provides parameterized MSBuild targets, such as Hx_NetBuild, Hx_Coverlet, Hx_NetTest, Hx_Validate etc., which represent separate steps in CI pipelines.

Each company designs some custom standards in organization of source code, so this build framework supports detailed customization.
Basically it follows "configurable conventions" approach.
It means, that source code file patterns, folders organization is configured on CI/CD servers and is passed into the build framework,
so all projects in your company just follow those conventions and are successfully recognized and built on CI servers.
Since every company has some custom standards of source code arrangement, this build framework supports solid customization.
Basically it follows the "configurable conventions" approach.

Default values of target parameters follow well-known standards in source code organization.
So, if you follow standards as well, you even do not neeed to write custom build scripts, like "Build.props", "MySuperProjectBuild.targets", "bla-bla.props" etc.
Default values of properties of MSBuild targets follow well-known pracices of arrangement of source code.
So, if you follow standards as well, you do not even neeed to write custom build scripts, like "Build.props", "MyProjectBuild.targets", "bla-bla.props" etc.

## Writing custom scripts

Expand Down Expand Up @@ -96,6 +94,3 @@ then their properties and items are not defined.
Use slash `/` in paths in MSBuild scripts, not backslash `\`, because MSBuild replaces them on *nix OSs anyway

Use slash `/` in path regular expressions in Heleonix.Build tasks.

### ToDo
- describe Hx_Int_ targets in xsd schemas
6 changes: 5 additions & 1 deletion src/Heleonix.Build/Tasks/Hx_GitHubCommitChangeLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ protected override void ExecuteInternal()
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {this.Token}");
client.DefaultRequestHeaders.Add("User-Agent", this.UserAgent);

var release = client.GetFromJsonAsync<JsonElement>($"{this.GitHubRepositoryApiUrl}/releases/latest");
var response = client.GetAsync($"{this.GitHubRepositoryApiUrl}/releases/latest");

response.Wait(3 * 60 * 1000);

var release = response.Result.Content.ReadFromJsonAsync<JsonElement>();

release.Wait(3 * 60 * 1000);

Expand Down
15 changes: 8 additions & 7 deletions test/Heleonix.Build.Tests/Tasks/Hx_GitHubCommitChangeLogTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,22 +227,23 @@ public static void Execute()
{
(
"http://localhost:12345/repos/heleonix/heleonix.build/releases/latest/",
request => (@"{}", HttpStatusCode.OK)),
request => (@"{}", HttpStatusCode.NotFound)),
(
"http://localhost:12345/repos/heleonix/heleonix.build/commits/",
request => (@"[]", HttpStatusCode.OK)),
request => (@"[{""commit"":{""message"":""fix(ID-1): Fix 1.""}}]", HttpStatusCode.OK)),
};

Should("succeed", () =>
{
Assert.That(succeeded, Is.True);
Assert.That(task.Version, Is.EqualTo("1.0.0"));
Assert.That(task.Changes.Length, Is.EqualTo(2));
Assert.That(task.Changes.Length, Is.EqualTo(3));

Assert.That(task.Changes[0].ItemSpec, Is.EqualTo("1.0.0"));
Assert.That(task.Changes[0].GetMetadata("Version"), Is.EqualTo("1.0.0"));
Assert.That(task.Changes[1].ItemSpec, Is.EqualTo("0.0.0"));
Assert.That(task.Changes[1].GetMetadata("PreviousVersion"), Is.EqualTo("0.0.0"));
Assert.That(task.Changes[0].ItemSpec, Is.EqualTo("fix(ID-1): Fix 1."));
Assert.That(task.Changes[1].ItemSpec, Is.EqualTo("1.0.0"));
Assert.That(task.Changes[1].GetMetadata("Version"), Is.EqualTo("1.0.0"));
Assert.That(task.Changes[2].ItemSpec, Is.EqualTo("0.0.0"));
Assert.That(task.Changes[2].GetMetadata("PreviousVersion"), Is.EqualTo("0.0.0"));
});
});
}
Expand Down

0 comments on commit db9efbb

Please sign in to comment.