Skip to content

Commit

Permalink
Merge branch 'release/5.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
devlead committed Nov 12, 2024
2 parents 4aa65cf + 4b31c94 commit 5782643
Show file tree
Hide file tree
Showing 51 changed files with 1,286 additions and 183 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": "4.1.0",
"version": "4.2.0",
"commands": [
"dotnet-cake"
]
Expand Down
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ body:
options:
- Cake .NET Tool
- Cake Frosting
- Cake runner for .NET Framework
- Cake runner for .NET Core
multiple: true
validations:
required: true
Expand All @@ -32,6 +30,7 @@ body:
- Linux
- Windows
- macOS
- FreeBSD
- N/A
multiple: true
validations:
Expand All @@ -40,8 +39,9 @@ body:
attributes:
label: Operating system architecture
options:
- 32-Bit
- 64-Bit
- x64
- x86
- Arm64
- N/A
validations:
required: true
Expand Down
27 changes: 18 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,45 @@ on:
- develop
- hotfix/*
jobs:
prepare:
name: Prepare integration tests
runs-on: ubuntu-latest
steps:
- run: echo "Cake Integration Tests" > cake-integration-tests.txt
- uses: actions/upload-artifact@v4
with:
name: cake-integration-tests
path: cake-integration-tests.txt

build:
name: Build
needs: prepare
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-13, ubuntu-latest]
steps:
- name: Get the sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install .NET SDK 6.0.x - 8.0.x
uses: actions/setup-dotnet@v3
- name: Install .NET SDK 8.0.x - 9.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
9.0.x
- name: Install .NET Core SDK (global.json)
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

- name: Run Cake script
id: build-cake
uses: cake-build/cake-action@v1
uses: cake-build/cake-action@master
with:
target: Run-Integration-Tests
cake-version: tool-manifest
Expand All @@ -47,7 +57,6 @@ jobs:
script-path: tests/integration/Cake.Common/Build/GitHubActions/ValidateGitHubActionsProvider.cake
cake-version: tool-manifest
arguments: |
CAKE_NETCOREAPP_6_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_6_0_VERSION_OS }}
CAKE_NETCOREAPP_7_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_7_0_VERSION_OS }}
CAKE_NETCOREAPP_8_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_8_0_VERSION_OS }}
CAKE_NETCOREAPP_9_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_9_0_VERSION_OS }}
ValidateGitHubActionsProvider: true
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 4.0.0
next-version: 5.0.0
branches:
master:
regex: main
Expand Down
12 changes: 12 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
### New in 5.0.0 (Released 2024/11/13)

* #4384 Remove obsolete members / methods.
* #4383 Update LatestPotentialBreakingChange to 5.0.0.
* #4346 Remove Unsupported TFMS .NET 6 & 7 (net6.0 & net7.0).
* #4396 Add DotNetSlnAdd alias for dotnet sln add command.
* #4393 Add DotNetSlnList alias for dotnet sln list command.
* #4379 C# 13 Scripting Support.
* #4345 Add .NET 9 (net9.0) TFM.
* #4310 Update Cake.Tool to support running on FreeBSD.
* #4391 DownloadArtifacts errors in latest Cake 4.2.0 with 404 error.

### New in 4.2.0 (Released 2024/10/23)

* #4374 Argument 'foo' was not set" after update to 4.1 in Cake Frosting.
Expand Down
7 changes: 3 additions & 4 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Task("Run-Unit-Tests")
() => GetFiles("./src/**/*.Tests.csproj"),
(parameters, project, context) =>
{
foreach(var framework in new[] { "net6.0", "net7.0", "net8.0" })
foreach(var framework in new[] { "net8.0", "net9.0" })
{
FilePath testResultsPath = MakeAbsolute(parameters.Paths.Directories.TestResults
.CombineWithFilePath($"{project.GetFilenameWithoutExtension()}_{framework}_TestResults.xml"));
Expand Down Expand Up @@ -368,9 +368,8 @@ Task("Run-Integration-Tests")
.DeferOnError()
.DoesForEach<BuildParameters, FilePath>(
parameters => new[] {
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net6.0/**/Cake.dll").Single(),
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net7.0/**/Cake.dll").Single(),
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net8.0/**/Cake.dll").Single()
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net8.0/**/Cake.dll").Single(),
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net9.0/**/Cake.dll").Single()
},
(parameters, cakeAssembly, context) =>
{
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"src"
],
"sdk": {
"version": "8.0.403",
"version": "9.0.100",
"rollForward": "latestFeature"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Threading.Tasks;
using Cake.Common.Build.GitHubActions.Commands;
using Cake.Common.Build.GitHubActions.Commands.Artifact;
using Cake.Common.Build.GitHubActions.Data;
using Cake.Common.Tests.Fakes;
using Cake.Core;
using Cake.Core.IO;
Expand All @@ -22,21 +21,45 @@ internal sealed class GitHubActionsCommandsFixture : HttpMessageHandler
private const string ArtifactUrl = GitHubActionsInfoFixture.ActionResultsUrl + "twirp/github.actions.results.api.v1.ArtifactService/";
private const string CreateArtifactUrl = ArtifactUrl + "CreateArtifact";
private const string FinalizeArtifactUrl = ArtifactUrl + "FinalizeArtifact";
private const string GetSignedArtifactURLurl = ArtifactUrl + "GetSignedArtifactURL";
private const string GetSignedArtifactURLUrl = ArtifactUrl + "GetSignedArtifactURL";
private const string ListArtifactsUrl = ArtifactUrl + "ListArtifacts";
private const string UploadFileUrl = "https://cake.build.net/actions-results/a9d82106-d5d5-4310-8f60-0bfac035cf02/workflow-job-run-1d849a45-2f30-5fbb-3226-b730a17a93af/artifacts/91e64594182918fa8012cdbf7d1a4f801fa0c35f485c3277268aad8e3f45377c.zip?sig=upload";
private const string DownloadFileUrl = "https://cake.build.net/actions-results/a9d82106-d5d5-4310-8f60-0bfac035cf02/workflow-job-run-1d849a45-2f30-5fbb-3226-b730a17a93af/artifacts/91e64594182918fa8012cdbf7d1a4f801fa0c35f485c3277268aad8e3f45377c.zip?sig=download";
private const string CreateArtifactResponse = @"{
""ok"": true,
""signed_upload_url"": """ + UploadFileUrl + @"""
}";
private const string FinalizeArtifactResponse = @"{
""ok"": true,
""artifact_id"": ""1991105334""
}";
private const string GetSignedArtifactURLResponse = @"{
""name"": ""artifact"",
""signed_url"": """ + DownloadFileUrl + @"""
}";
private const string CreateArtifactResponse =
$$"""
{
"ok": true,
"signed_upload_url": "{{UploadFileUrl}}"
}
""";
private const string FinalizeArtifactResponse =
"""
{
"ok": true,
"artifact_id": "1991105334"
}
""";
private const string GetSignedArtifactURLResponse =
$$"""
{
"name": "artifact",
"signed_url": "{{DownloadFileUrl}}"
}
""";
private const string ListArtifactsResponse =
$$"""
{
"artifacts": [
{
"workflow_run_backend_id": "b9e28153-ca20-4b86-91dd-09e8f644efdf",
"workflow_job_run_backend_id": "1d849a45-2f30-5fbb-3226-b730a17a93af",
"database_id": "1",
"name": "artifact",
"created_at": "2024-11-09T21:53:00.7110204+00:00"
}
]
}
""";

private GitHubActionsInfoFixture GitHubActionsInfoFixture { get; }
private ICakeEnvironment Environment { get; }
Expand Down Expand Up @@ -122,7 +145,7 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
// Get Signed Artifact Url
case
{
RequestUri: { AbsoluteUri: GetSignedArtifactURLurl },
RequestUri: { AbsoluteUri: GetSignedArtifactURLUrl },
Method: { Method: "POST" },
}:
{
Expand Down Expand Up @@ -189,6 +212,16 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
return Ok();
}

// List Artifacts
case
{
RequestUri: { AbsoluteUri: ListArtifactsUrl },
Method: { Method: "POST" }
}:
{
return Ok(new StringContent(ListArtifactsResponse));
}

// Download File
case
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using Cake.Common.Tools.DotNet.Sln.Add;
using Cake.Core.IO;

namespace Cake.Common.Tests.Fixtures.Tools.DotNet.Sln.Add
{
internal sealed class DotNetSlnAdderFixture : DotNetFixture<DotNetSlnAddSettings>
{
public FilePath Solution { get; set; }

public IEnumerable<FilePath> ProjectPath { get; set; }

protected override void RunTool()
{
var tool = new DotNetSlnAdder(FileSystem, Environment, ProcessRunner, Tools);
tool.Add(Solution, ProjectPath, Settings);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using Cake.Common.Tools.DotNet.Sln.List;

namespace Cake.Common.Tests.Fixtures.Tools.DotNet.Sln.List
{
internal sealed class DotNetSlnListerFixture : DotNetFixture<DotNetSlnListSettings>
{
public string Solution { get; set; }

public string StandardError { get; set; }

public IEnumerable<string> Projects { get; private set; }

public void GivenProjectsResult()
{
ProcessRunner.Process.SetStandardOutput(new string[]
{
"Project(s)",
"--------------------",
"Common\\Common.AspNetCore\\Common.AspNetCore.csproj",
"Common\\Common.Messaging\\Common.Messaging.csproj",
"Common\\Common.Utilities\\Common.Utilities.csproj"
});
}

public void GivenErrorResult()
{
ProcessRunner.Process.SetStandardError(new string[]
{
StandardError
});
}

protected override void RunTool()
{
var tool = new DotNetSlnLister(FileSystem, Environment, ProcessRunner, Tools);
Projects = tool.List(Solution, Settings);
}
}
}
35 changes: 35 additions & 0 deletions src/Cake.Common.Tests/Unit/EnvironmentAliasesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public void Should_Throw_If_Context_Is_Null()
[Theory]
[InlineData(PlatformFamily.Linux, false)]
[InlineData(PlatformFamily.OSX, false)]
[InlineData(PlatformFamily.FreeBSD, false)]
[InlineData(PlatformFamily.Windows, true)]
public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
{
Expand Down Expand Up @@ -212,6 +213,7 @@ public void Should_Throw_If_Context_Is_Null()
[Theory]
[InlineData(PlatformFamily.Linux, true)]
[InlineData(PlatformFamily.OSX, true)]
[InlineData(PlatformFamily.FreeBSD, true)]
[InlineData(PlatformFamily.Windows, false)]
public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
{
Expand Down Expand Up @@ -242,6 +244,7 @@ public void Should_Throw_If_Context_Is_Null()
[Theory]
[InlineData(PlatformFamily.Linux, true)]
[InlineData(PlatformFamily.OSX, false)]
[InlineData(PlatformFamily.FreeBSD, false)]
[InlineData(PlatformFamily.Windows, false)]
public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
{
Expand Down Expand Up @@ -272,6 +275,7 @@ public void Should_Throw_If_Context_Is_Null()
[Theory]
[InlineData(PlatformFamily.Linux, false)]
[InlineData(PlatformFamily.OSX, true)]
[InlineData(PlatformFamily.FreeBSD, false)]
[InlineData(PlatformFamily.Windows, false)]
public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
{
Expand All @@ -286,5 +290,36 @@ public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
Assert.Equal(expected, result);
}
}

public sealed class TheIsRunningOnFreeBSDMethod
{
[Fact]
public void Should_Throw_If_Context_Is_Null()
{
// Given, When
var result = Record.Exception(() => EnvironmentAliases.IsRunningOnFreeBSD(null));

// Then
AssertEx.IsArgumentNullException(result, "context");
}

[Theory]
[InlineData(PlatformFamily.Linux, false)]
[InlineData(PlatformFamily.OSX, false)]
[InlineData(PlatformFamily.FreeBSD, true)]
[InlineData(PlatformFamily.Windows, false)]
public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
{
// Given
var context = Substitute.For<ICakeContext>();
context.Environment.Returns(new FakeEnvironment(family));

// When
var result = EnvironmentAliases.IsRunningOnFreeBSD(context);

// Then
Assert.Equal(expected, result);
}
}
}
}
Loading

0 comments on commit 5782643

Please sign in to comment.