Skip to content

Commit 5782643

Browse files
committed
Merge branch 'release/5.0.0'
2 parents 4aa65cf + 4b31c94 commit 5782643

File tree

51 files changed

+1286
-183
lines changed

Some content is hidden

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

51 files changed

+1286
-183
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": "4.1.0",
6+
"version": "4.2.0",
77
"commands": [
88
"dotnet-cake"
99
]

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ body:
1515
options:
1616
- Cake .NET Tool
1717
- Cake Frosting
18-
- Cake runner for .NET Framework
19-
- Cake runner for .NET Core
2018
multiple: true
2119
validations:
2220
required: true
@@ -32,6 +30,7 @@ body:
3230
- Linux
3331
- Windows
3432
- macOS
33+
- FreeBSD
3534
- N/A
3635
multiple: true
3736
validations:
@@ -40,8 +39,9 @@ body:
4039
attributes:
4140
label: Operating system architecture
4241
options:
43-
- 32-Bit
44-
- 64-Bit
42+
- x64
43+
- x86
44+
- Arm64
4545
- N/A
4646
validations:
4747
required: true

.github/workflows/build.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,45 @@ on:
77
- develop
88
- hotfix/*
99
jobs:
10+
prepare:
11+
name: Prepare integration tests
12+
runs-on: ubuntu-latest
13+
steps:
14+
- run: echo "Cake Integration Tests" > cake-integration-tests.txt
15+
- uses: actions/upload-artifact@v4
16+
with:
17+
name: cake-integration-tests
18+
path: cake-integration-tests.txt
19+
1020
build:
1121
name: Build
22+
needs: prepare
1223
runs-on: ${{ matrix.os }}
1324
strategy:
1425
fail-fast: false
1526
matrix:
1627
os: [windows-latest, macos-13, ubuntu-latest]
1728
steps:
1829
- name: Get the sources
19-
uses: actions/checkout@v3
30+
uses: actions/checkout@v4
2031
with:
2132
fetch-depth: 0
2233

23-
- name: Install .NET SDK 6.0.x - 8.0.x
24-
uses: actions/setup-dotnet@v3
34+
- name: Install .NET SDK 8.0.x - 9.0.x
35+
uses: actions/setup-dotnet@v4
2536
with:
2637
dotnet-version: |
27-
6.0.x
28-
7.0.x
2938
8.0.x
39+
9.0.x
3040
3141
- name: Install .NET Core SDK (global.json)
32-
uses: actions/setup-dotnet@v3
42+
uses: actions/setup-dotnet@v4
3343
with:
3444
global-json-file: global.json
3545

3646
- name: Run Cake script
3747
id: build-cake
38-
uses: cake-build/cake-action@v1
48+
uses: cake-build/cake-action@master
3949
with:
4050
target: Run-Integration-Tests
4151
cake-version: tool-manifest
@@ -47,7 +57,6 @@ jobs:
4757
script-path: tests/integration/Cake.Common/Build/GitHubActions/ValidateGitHubActionsProvider.cake
4858
cake-version: tool-manifest
4959
arguments: |
50-
CAKE_NETCOREAPP_6_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_6_0_VERSION_OS }}
51-
CAKE_NETCOREAPP_7_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_7_0_VERSION_OS }}
5260
CAKE_NETCOREAPP_8_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_8_0_VERSION_OS }}
61+
CAKE_NETCOREAPP_9_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_9_0_VERSION_OS }}
5362
ValidateGitHubActionsProvider: true

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
next-version: 4.0.0
1+
next-version: 5.0.0
22
branches:
33
master:
44
regex: main

ReleaseNotes.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
### New in 5.0.0 (Released 2024/11/13)
2+
3+
* #4384 Remove obsolete members / methods.
4+
* #4383 Update LatestPotentialBreakingChange to 5.0.0.
5+
* #4346 Remove Unsupported TFMS .NET 6 & 7 (net6.0 & net7.0).
6+
* #4396 Add DotNetSlnAdd alias for dotnet sln add command.
7+
* #4393 Add DotNetSlnList alias for dotnet sln list command.
8+
* #4379 C# 13 Scripting Support.
9+
* #4345 Add .NET 9 (net9.0) TFM.
10+
* #4310 Update Cake.Tool to support running on FreeBSD.
11+
* #4391 DownloadArtifacts errors in latest Cake 4.2.0 with 404 error.
12+
113
### New in 4.2.0 (Released 2024/10/23)
214

315
* #4374 Argument 'foo' was not set" after update to 4.1 in Cake Frosting.

build.cake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Task("Run-Unit-Tests")
108108
() => GetFiles("./src/**/*.Tests.csproj"),
109109
(parameters, project, context) =>
110110
{
111-
foreach(var framework in new[] { "net6.0", "net7.0", "net8.0" })
111+
foreach(var framework in new[] { "net8.0", "net9.0" })
112112
{
113113
FilePath testResultsPath = MakeAbsolute(parameters.Paths.Directories.TestResults
114114
.CombineWithFilePath($"{project.GetFilenameWithoutExtension()}_{framework}_TestResults.xml"));
@@ -368,9 +368,8 @@ Task("Run-Integration-Tests")
368368
.DeferOnError()
369369
.DoesForEach<BuildParameters, FilePath>(
370370
parameters => new[] {
371-
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net6.0/**/Cake.dll").Single(),
372-
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net7.0/**/Cake.dll").Single(),
373-
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net8.0/**/Cake.dll").Single()
371+
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net8.0/**/Cake.dll").Single(),
372+
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net9.0/**/Cake.dll").Single()
374373
},
375374
(parameters, cakeAssembly, context) =>
376375
{

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"src"
44
],
55
"sdk": {
6-
"version": "8.0.403",
6+
"version": "9.0.100",
77
"rollForward": "latestFeature"
88
}
99
}

src/Cake.Common.Tests/Fixtures/Build/GitHubActionsCommandsFixture.cs

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using System.Threading.Tasks;
88
using Cake.Common.Build.GitHubActions.Commands;
99
using Cake.Common.Build.GitHubActions.Commands.Artifact;
10-
using Cake.Common.Build.GitHubActions.Data;
1110
using Cake.Common.Tests.Fakes;
1211
using Cake.Core;
1312
using Cake.Core.IO;
@@ -22,21 +21,45 @@ internal sealed class GitHubActionsCommandsFixture : HttpMessageHandler
2221
private const string ArtifactUrl = GitHubActionsInfoFixture.ActionResultsUrl + "twirp/github.actions.results.api.v1.ArtifactService/";
2322
private const string CreateArtifactUrl = ArtifactUrl + "CreateArtifact";
2423
private const string FinalizeArtifactUrl = ArtifactUrl + "FinalizeArtifact";
25-
private const string GetSignedArtifactURLurl = ArtifactUrl + "GetSignedArtifactURL";
24+
private const string GetSignedArtifactURLUrl = ArtifactUrl + "GetSignedArtifactURL";
25+
private const string ListArtifactsUrl = ArtifactUrl + "ListArtifacts";
2626
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";
2727
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";
28-
private const string CreateArtifactResponse = @"{
29-
""ok"": true,
30-
""signed_upload_url"": """ + UploadFileUrl + @"""
31-
}";
32-
private const string FinalizeArtifactResponse = @"{
33-
""ok"": true,
34-
""artifact_id"": ""1991105334""
35-
}";
36-
private const string GetSignedArtifactURLResponse = @"{
37-
""name"": ""artifact"",
38-
""signed_url"": """ + DownloadFileUrl + @"""
39-
}";
28+
private const string CreateArtifactResponse =
29+
$$"""
30+
{
31+
"ok": true,
32+
"signed_upload_url": "{{UploadFileUrl}}"
33+
}
34+
""";
35+
private const string FinalizeArtifactResponse =
36+
"""
37+
{
38+
"ok": true,
39+
"artifact_id": "1991105334"
40+
}
41+
""";
42+
private const string GetSignedArtifactURLResponse =
43+
$$"""
44+
{
45+
"name": "artifact",
46+
"signed_url": "{{DownloadFileUrl}}"
47+
}
48+
""";
49+
private const string ListArtifactsResponse =
50+
$$"""
51+
{
52+
"artifacts": [
53+
{
54+
"workflow_run_backend_id": "b9e28153-ca20-4b86-91dd-09e8f644efdf",
55+
"workflow_job_run_backend_id": "1d849a45-2f30-5fbb-3226-b730a17a93af",
56+
"database_id": "1",
57+
"name": "artifact",
58+
"created_at": "2024-11-09T21:53:00.7110204+00:00"
59+
}
60+
]
61+
}
62+
""";
4063

4164
private GitHubActionsInfoFixture GitHubActionsInfoFixture { get; }
4265
private ICakeEnvironment Environment { get; }
@@ -122,7 +145,7 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
122145
// Get Signed Artifact Url
123146
case
124147
{
125-
RequestUri: { AbsoluteUri: GetSignedArtifactURLurl },
148+
RequestUri: { AbsoluteUri: GetSignedArtifactURLUrl },
126149
Method: { Method: "POST" },
127150
}:
128151
{
@@ -189,6 +212,16 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
189212
return Ok();
190213
}
191214

215+
// List Artifacts
216+
case
217+
{
218+
RequestUri: { AbsoluteUri: ListArtifactsUrl },
219+
Method: { Method: "POST" }
220+
}:
221+
{
222+
return Ok(new StringContent(ListArtifactsResponse));
223+
}
224+
192225
// Download File
193226
case
194227
{
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Collections.Generic;
6+
using Cake.Common.Tools.DotNet.Sln.Add;
7+
using Cake.Core.IO;
8+
9+
namespace Cake.Common.Tests.Fixtures.Tools.DotNet.Sln.Add
10+
{
11+
internal sealed class DotNetSlnAdderFixture : DotNetFixture<DotNetSlnAddSettings>
12+
{
13+
public FilePath Solution { get; set; }
14+
15+
public IEnumerable<FilePath> ProjectPath { get; set; }
16+
17+
protected override void RunTool()
18+
{
19+
var tool = new DotNetSlnAdder(FileSystem, Environment, ProcessRunner, Tools);
20+
tool.Add(Solution, ProjectPath, Settings);
21+
}
22+
}
23+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Collections.Generic;
6+
using Cake.Common.Tools.DotNet.Sln.List;
7+
8+
namespace Cake.Common.Tests.Fixtures.Tools.DotNet.Sln.List
9+
{
10+
internal sealed class DotNetSlnListerFixture : DotNetFixture<DotNetSlnListSettings>
11+
{
12+
public string Solution { get; set; }
13+
14+
public string StandardError { get; set; }
15+
16+
public IEnumerable<string> Projects { get; private set; }
17+
18+
public void GivenProjectsResult()
19+
{
20+
ProcessRunner.Process.SetStandardOutput(new string[]
21+
{
22+
"Project(s)",
23+
"--------------------",
24+
"Common\\Common.AspNetCore\\Common.AspNetCore.csproj",
25+
"Common\\Common.Messaging\\Common.Messaging.csproj",
26+
"Common\\Common.Utilities\\Common.Utilities.csproj"
27+
});
28+
}
29+
30+
public void GivenErrorResult()
31+
{
32+
ProcessRunner.Process.SetStandardError(new string[]
33+
{
34+
StandardError
35+
});
36+
}
37+
38+
protected override void RunTool()
39+
{
40+
var tool = new DotNetSlnLister(FileSystem, Environment, ProcessRunner, Tools);
41+
Projects = tool.List(Solution, Settings);
42+
}
43+
}
44+
}

src/Cake.Common.Tests/Unit/EnvironmentAliasesTests.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ public void Should_Throw_If_Context_Is_Null()
182182
[Theory]
183183
[InlineData(PlatformFamily.Linux, false)]
184184
[InlineData(PlatformFamily.OSX, false)]
185+
[InlineData(PlatformFamily.FreeBSD, false)]
185186
[InlineData(PlatformFamily.Windows, true)]
186187
public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
187188
{
@@ -212,6 +213,7 @@ public void Should_Throw_If_Context_Is_Null()
212213
[Theory]
213214
[InlineData(PlatformFamily.Linux, true)]
214215
[InlineData(PlatformFamily.OSX, true)]
216+
[InlineData(PlatformFamily.FreeBSD, true)]
215217
[InlineData(PlatformFamily.Windows, false)]
216218
public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
217219
{
@@ -242,6 +244,7 @@ public void Should_Throw_If_Context_Is_Null()
242244
[Theory]
243245
[InlineData(PlatformFamily.Linux, true)]
244246
[InlineData(PlatformFamily.OSX, false)]
247+
[InlineData(PlatformFamily.FreeBSD, false)]
245248
[InlineData(PlatformFamily.Windows, false)]
246249
public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
247250
{
@@ -272,6 +275,7 @@ public void Should_Throw_If_Context_Is_Null()
272275
[Theory]
273276
[InlineData(PlatformFamily.Linux, false)]
274277
[InlineData(PlatformFamily.OSX, true)]
278+
[InlineData(PlatformFamily.FreeBSD, false)]
275279
[InlineData(PlatformFamily.Windows, false)]
276280
public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
277281
{
@@ -286,5 +290,36 @@ public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
286290
Assert.Equal(expected, result);
287291
}
288292
}
293+
294+
public sealed class TheIsRunningOnFreeBSDMethod
295+
{
296+
[Fact]
297+
public void Should_Throw_If_Context_Is_Null()
298+
{
299+
// Given, When
300+
var result = Record.Exception(() => EnvironmentAliases.IsRunningOnFreeBSD(null));
301+
302+
// Then
303+
AssertEx.IsArgumentNullException(result, "context");
304+
}
305+
306+
[Theory]
307+
[InlineData(PlatformFamily.Linux, false)]
308+
[InlineData(PlatformFamily.OSX, false)]
309+
[InlineData(PlatformFamily.FreeBSD, true)]
310+
[InlineData(PlatformFamily.Windows, false)]
311+
public void Should_Return_Correct_Value(PlatformFamily family, bool expected)
312+
{
313+
// Given
314+
var context = Substitute.For<ICakeContext>();
315+
context.Environment.Returns(new FakeEnvironment(family));
316+
317+
// When
318+
var result = EnvironmentAliases.IsRunningOnFreeBSD(context);
319+
320+
// Then
321+
Assert.Equal(expected, result);
322+
}
323+
}
289324
}
290325
}

0 commit comments

Comments
 (0)