Skip to content

Commit d43d440

Browse files
devleadjarlehjortland
authored andcommitted
GH4629: Update Verify.XunitV3 to 31.0.4 (cake-build#4630)
(cake-buildGH-4629) Update Verify.XunitV3 to 31.0.4 * fixes cake-build#4629 GH4631: GitHub Actions Workflow Updates (cake-build#4632) * (cake-buildGH-4631) GitHub Actions Workflow Updates ### Action Version Updates - `actions/checkout`: v4 → v5 - `actions/setup-dotnet`: v4 → v5 - `cake-build/cake-action`: master → v3.0.1 - CodeQL actions: v2 → v4 ### Build Matrix Changes - **Removed**: `macos-13` (deprecated) - **Added**: `macos-15-intel` and `macos-latest` runners - Maintained existing `windows-latest` and `ubuntu-latest` ### CodeQL Improvements - Added explicit `build-mode: 'autobuild'` - Added .NET SDK 8.0.x/9.0.x setup steps - Added `CAKE_INSTALL_SUPPORTED_SDKS: true` env var (to implicit install all SDKs for build script phase) ### New .NET Support - Added .NET 10.0 validation: `CAKE_NETCOREAPP_10_0_VERSION_OS` - fixes cake-build#4631 * feat: Improve GitHub Actions integration and test coverage - Include runner architecture in artifact naming and validation - Update BuildData record to include Architecture field - Add .NET 10.0 path validation in integration tests - Update Cake.Git addin version from 4.0.0 to 5.0.1 - Skip native assembly loading tests on ARM64 runners * feat: Include runner architecture in GitHub Actions artifact naming - Add runner architecture to artifact name for better identification - Ensures unique artifact names across different runner architectures GH4627: Add explicit path type support for .NET 10+ compatibility (cake-build#4633) (cake-buildGH-4627) Add explicit path type support for .NET 10+ compatibility Adds DotNetTestPathType enum and PathType property to DotNetTestSettings to support explicit --project and --solution parameters required by .NET 10+. Changes: - Add DotNetTestPathType enum with None, Auto, Project, and Solution values - Add PathType property to DotNetTestSettings (defaults to None for backward compatibility) - Update DotNetTester to handle path type logic with switch expressions - Add comprehensive unit tests covering all path type scenarios - Support auto-detection based on file extensions (.sln, .csproj, .vbproj, .fsproj, .vcxproj) Resolves cake-build#4627 (cake-buildGH-4638) Update Spectre.Console to 0.53.0 - fixes cake-build#4638 cake-buildGH-4639: Enable Spectre.Console report printer by default Also fixes some bugs with the initial implementation, as well as making sure that the borders have a safe (non-unicode) fallback. Closes cake-build#4639 (cake-buildGH-4636) Enhance FileSystem Abstractions & tests Added timestamps, Unix modes, performance improvements and dedicated for Fake File/Directory. - Add comprehensive timestamp and Unix file mode support across IFile/IDirectory interfaces - Implement LastWriteTimeUtc, CreationTimeUtc, LastAccessTimeUtc, and UnixFileMode properties - Add Set* methods for timestamp and Unix file mode manipulation - Improve performance by replacing GetFiles/GetDirectories with EnumerateFiles/EnumerateDirectories - Create dedicated Cake.Testing.Tests project with comprehensive unit test coverage - Add snapshot testing with Verify for FakeFile and FakeDirectory operations - Fill gaps in file system abstraction with cross-platform Unix file mode support - Integrate Microsoft.Extensions.TimeProvider.Testing for reliable time handling in tests - Refactor FakeDirectory to use yield return for lazy evaluation performance benefits - Add extensive test coverage for Create, Move, Delete, GetDirectories, and GetFiles operations - fixes cake-build#4636 ### Breaking Changes - [x] There shouldn't be any breaking changes identified, all new interface members have default implementations / values. #### IFileSystemInfo Interface (Base interface) - [x] `DateTime? LastWriteTimeUtc` - Default: `null` - [x] `DateTime? CreationTimeUtc` - Default: `null` - [x] `DateTime? LastAccessTimeUtc` - Default: `null` - [x] `UnixFileMode? UnixFileMode` - Default: `null` #### IDirectory Interface - [x] `IDirectory SetCreationTime(DateTime creationTime)` - Default: `return this` - [x] `IDirectory SetCreationTimeUtc(DateTime creationTimeUtc)` - Default: `return this` - [x] `IDirectory SetLastAccessTime(DateTime lastAccessTime)` - Default: `return this` - [x] `IDirectory SetLastAccessTimeUtc(DateTime lastAccessTimeUtc)` - Default: `return this` - [x] `IDirectory SetLastWriteTime(DateTime lastWriteTime)` - Default: `return this` - [x] `IDirectory SetLastWriteTimeUtc(DateTime lastWriteTimeUtc)` - Default: `return this` - [x] `IDirectory SetUnixFileMode(UnixFileMode unixFileMode)` - Default: `return this` #### IFile Interface - [x] `IFile SetUnixFileMode(UnixFileMode unixFileMode)` - Default: `return this` ### Key Changes Made - [x] Added UTC time properties to IFileSystemInfo with default null values - [x] Added Unix file mode support with UnixFileMode property and setter methods - [x] Added time setter methods for both IDirectory and IFile interfaces - [x] Performance improvement: Changed from GetDirectories()/GetFiles() to EnumerateDirectories()/EnumerateFiles() - [x] Added _file.Refresh() calls after time-setting operations to ensure consistency - [x] Added platform-specific attributes ([UnsupportedOSPlatform("windows")]) for Unix-specific methods
1 parent 2e9ef34 commit d43d440

File tree

155 files changed

+4577
-290
lines changed

Some content is hidden

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

155 files changed

+4577
-290
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,28 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
os: [windows-latest, macos-13, ubuntu-latest]
27+
os: [windows-latest, macos-15-intel, ubuntu-latest, macos-latest]
2828
steps:
2929
- name: Get the sources
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@v5
3131
with:
3232
fetch-depth: 0
3333

3434
- name: Install .NET SDK 8.0.x - 9.0.x
35-
uses: actions/setup-dotnet@v4
35+
uses: actions/setup-dotnet@v5
3636
with:
3737
dotnet-version: |
3838
8.0.x
3939
9.0.x
4040
4141
- name: Install .NET SDK (global.json)
42-
uses: actions/setup-dotnet@v4
42+
uses: actions/setup-dotnet@v5
4343
with:
4444
global-json-file: global.json
4545

4646
- name: Run Cake script
4747
id: build-cake
48-
uses: cake-build/cake-action@master
48+
uses: cake-build/cake-action@v3.0.1
4949
env:
5050
AZURE_DEVOPS_NUGET_API_KEY: ${{ secrets.AZURE_DEVOPS_NUGET_API_KEY }}
5151
AZURE_DEVOPS_NUGET_API_URL: ${{ secrets.AZURE_DEVOPS_NUGET_API_URL }}
@@ -55,11 +55,12 @@ jobs:
5555

5656
- name: Validate Integration Tests
5757
id: validate-cake
58-
uses: cake-build/cake-action@master
58+
uses: cake-build/cake-action@v3.0.1
5959
with:
6060
script-path: tests/integration/Cake.Common/Build/GitHubActions/ValidateGitHubActionsProvider.cake
6161
cake-version: tool-manifest
6262
arguments: |
6363
CAKE_NETCOREAPP_8_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_8_0_VERSION_OS }}
6464
CAKE_NETCOREAPP_9_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_9_0_VERSION_OS }}
65+
CAKE_NETCOREAPP_10_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_10_0_VERSION_OS }}
6566
ValidateGitHubActionsProvider: true

.github/workflows/codeql-analysis.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,39 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
language: [ 'csharp' ]
19+
include:
20+
- language: 'csharp'
21+
build-mode: 'autobuild'
2022

2123
steps:
24+
2225
- name: Checkout repository
23-
uses: actions/checkout@v3
26+
uses: actions/checkout@v5
2427
with:
2528
fetch-depth: 0
2629

30+
- name: Install .NET SDK 8.0.x - 9.0.x
31+
uses: actions/setup-dotnet@v5
32+
with:
33+
dotnet-version: |
34+
8.0.x
35+
9.0.x
36+
37+
- name: Install .NET SDK (global.json)
38+
uses: actions/setup-dotnet@v5
39+
with:
40+
global-json-file: global.json
41+
2742
- name: Initialize CodeQL
28-
uses: github/codeql-action/init@v2
43+
uses: github/codeql-action/init@v4
2944
with:
3045
languages: ${{ matrix.language }}
46+
build-mode: ${{ matrix.build-mode }}
3147

3248
- name: Autobuild
33-
uses: github/codeql-action/autobuild@v2
49+
uses: github/codeql-action/autobuild@v4
50+
env:
51+
CAKE_INSTALL_SUPPORTED_SDKS: true
3452

3553
- name: Perform CodeQL Analysis
36-
uses: github/codeql-action/analyze@v2
54+
uses: github/codeql-action/analyze@v4

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
environment: Production
1919
steps:
2020
- name: Get the sources
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v5
2222
with:
2323
fetch-depth: 0
2424

@@ -30,14 +30,14 @@ jobs:
3030
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
3131

3232
- name: Install .NET SDK 8.0.x - 9.0.x
33-
uses: actions/setup-dotnet@v4
33+
uses: actions/setup-dotnet@v5
3434
with:
3535
dotnet-version: |
3636
8.0.x
3737
9.0.x
3838
3939
- name: Install .NET SDK (global.json)
40-
uses: actions/setup-dotnet@v4
40+
uses: actions/setup-dotnet@v5
4141
with:
4242
global-json-file: global.json
4343

@@ -49,7 +49,7 @@ jobs:
4949

5050

5151
- name: Build & Release Cake
52-
uses: cake-build/cake-action@master
52+
uses: cake-build/cake-action@v3.0.1
5353
env:
5454
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5555
CAKE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.cake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Task("Restore-NuGet-Packages")
8888
.IsDependentOn("Clean")
8989
.Does<BuildParameters>((context, parameters) =>
9090
{
91-
DotNetRestore("./src/Cake.sln", new DotNetRestoreSettings
91+
DotNetRestore("./src/Cake.slnx", new DotNetRestoreSettings
9292
{
9393
Verbosity = DotNetVerbosity.Minimal,
9494
Sources = new [] { "https://api.nuget.org/v3/index.json" },
@@ -101,7 +101,7 @@ Task("Build")
101101
.Does<BuildParameters>((context, parameters) =>
102102
{
103103
// Build the solution.
104-
var path = MakeAbsolute(new DirectoryPath("./src/Cake.sln"));
104+
var path = MakeAbsolute(new DirectoryPath("./src/Cake.slnx"));
105105
DotNetBuild(path.FullPath, new DotNetBuildSettings
106106
{
107107
Configuration = parameters.Configuration,
@@ -214,7 +214,7 @@ Task("Upload-GitHubActions-Artifacts")
214214
static (context, parameters) => context
215215
.GitHubActions() is var gh && gh != null
216216
? gh.Commands
217-
.UploadArtifact(parameters.Paths.Directories.NuGetRoot, $"Artifact_{gh.Environment.Runner.ImageOS ?? gh.Environment.Runner.OS}_{context.Environment.Runtime.BuiltFramework.Identifier}_{context.Environment.Runtime.BuiltFramework.Version}")
217+
.UploadArtifact(parameters.Paths.Directories.NuGetRoot, $"Artifact_{gh.Environment.Runner.ImageOS ?? gh.Environment.Runner.OS}_{gh.Environment.Runner.Architecture}_{context.Environment.Runtime.BuiltFramework.Identifier}_{context.Environment.Runtime.BuiltFramework.Version}")
218218
: throw new Exception("GitHubActions not available")
219219
);
220220

@@ -416,7 +416,7 @@ Task("Run-Integration-Tests")
416416
},
417417
ArgumentCustomization = args => args
418418
.AppendSwitchQuoted("--target", " ", Argument("integration-tests-target", "Run-All-Tests"))
419-
.AppendSwitchQuoted("--verbosity", " ", "quiet")
419+
.AppendSwitchQuoted("--verbosity", " ", Argument("integration-tests-verbosity", "quiet"))
420420
.AppendSwitchQuoted("--platform", " ", parameters.IsRunningOnWindows ? "windows" : "posix")
421421
.AppendSwitchQuoted("--customarg", " ", "hello")
422422
.AppendSwitchQuoted("--multipleargs", "=", "a")

src/Cake.Cli/Infrastructure/CakeSpectreReportPrinter.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void Write(CakeReport report)
4444
table.AddColumn(
4545
new TableColumn(
4646
new Text("Duration", rowStyle)).Footer(
47-
new Text(FormatTime(GetTotalTime(report)), rowStyle)));
47+
new Text(FormatTime(GetTotalTime(report)).EscapeMarkup(), rowStyle)));
4848

4949
table.AddColumn(
5050
new TableColumn(
@@ -61,16 +61,16 @@ public void Write(CakeReport report)
6161

6262
if (includeSkippedReasonColumn)
6363
{
64-
table.AddRow(new Markup(item.TaskName, itemStyle),
65-
new Markup(FormatDuration(item), itemStyle),
66-
new Markup(item.ExecutionStatus.ToString(), itemStyle),
67-
new Markup(item.SkippedMessage, itemStyle));
64+
table.AddRow(new Markup(item.TaskName.EscapeMarkup(), itemStyle),
65+
new Markup(FormatDuration(item).EscapeMarkup(), itemStyle),
66+
new Markup(item.ExecutionStatus.ToString().EscapeMarkup(), itemStyle),
67+
new Markup(item.SkippedMessage.EscapeMarkup(), itemStyle));
6868
}
6969
else
7070
{
71-
table.AddRow(new Markup(item.TaskName, itemStyle),
72-
new Markup(FormatDuration(item), itemStyle),
73-
new Markup(item.ExecutionStatus.ToString(), itemStyle));
71+
table.AddRow(new Markup(item.TaskName.EscapeMarkup(), itemStyle),
72+
new Markup(FormatDuration(item).EscapeMarkup(), itemStyle),
73+
new Markup(item.ExecutionStatus.ToString().EscapeMarkup(), itemStyle));
7474
}
7575
}
7676

@@ -88,7 +88,7 @@ public void WriteStep(string name, Verbosity verbosity)
8888

8989
var table = new Table().Border(DoubleBorder.Shared);
9090
table.Width(100);
91-
table.AddColumn(name);
91+
table.AddColumn(name.EscapeMarkup());
9292
_console.Write(new Padder(table).Padding(0, 1, 0, 0));
9393
}
9494

@@ -104,7 +104,7 @@ public void WriteLifeCycleStep(string name, Verbosity verbosity)
104104

105105
var table = new Table().Border(SingleBorder.Shared);
106106
table.Width(100);
107-
table.AddColumn(name);
107+
table.AddColumn(name.EscapeMarkup());
108108
_console.Write(table);
109109
}
110110

@@ -118,9 +118,12 @@ public void WriteSkippedStep(string name, Verbosity verbosity)
118118

119119
_console.WriteLine();
120120

121-
var table = new Table().Border(DoubleBorder.Shared);
121+
var table = new Table()
122+
.Border(DoubleBorder.Shared)
123+
.BorderStyle(new Style(ConsoleColor.Gray));
124+
122125
table.Width(100);
123-
table.AddColumn(name);
126+
table.AddColumn(name.EscapeMarkup());
124127
_console.Write(table);
125128
}
126129

src/Cake.Cli/Infrastructure/DoubleBorder.cs

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
4+
#nullable enable
45

56
using Spectre.Console;
67
using Spectre.Console.Rendering;
@@ -15,7 +16,10 @@ public class DoubleBorder : TableBorder
1516
/// <summary>
1617
/// Gets a single instance of the DoubleBorder class.
1718
/// </summary>
18-
public static DoubleBorder Shared { get; } = new DoubleBorder();
19+
public static TableBorder Shared { get; } = new DoubleBorder();
20+
21+
/// <inheritdoc/>
22+
public override TableBorder? SafeBorder => new Safe();
1923

2024
/// <summary>
2125
/// Get information about the custom border.
@@ -26,10 +30,31 @@ public override string GetPart(TableBorderPart part)
2630
{
2731
return part switch
2832
{
29-
TableBorderPart.HeaderTop => "=",
30-
TableBorderPart.FooterBottom => "=",
33+
TableBorderPart.HeaderTopLeft => "═",
34+
TableBorderPart.HeaderTop => "═",
35+
TableBorderPart.HeaderTopRight => "═",
36+
TableBorderPart.FooterBottomLeft => "═",
37+
TableBorderPart.FooterBottom => "═",
38+
TableBorderPart.FooterBottomRight => "═",
3139
_ => string.Empty,
3240
};
3341
}
42+
43+
private sealed class Safe : TableBorder
44+
{
45+
public override string GetPart(TableBorderPart part)
46+
{
47+
return part switch
48+
{
49+
TableBorderPart.HeaderTopLeft => "=",
50+
TableBorderPart.HeaderTop => "=",
51+
TableBorderPart.HeaderTopRight => "=",
52+
TableBorderPart.FooterBottomLeft => "=",
53+
TableBorderPart.FooterBottom => "=",
54+
TableBorderPart.FooterBottomRight => "=",
55+
_ => string.Empty,
56+
};
57+
}
58+
}
3459
}
3560
}

src/Cake.Cli/Infrastructure/SingleBorder.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ public class SingleBorder : TableBorder
1717
/// </summary>
1818
public static SingleBorder Shared { get; } = new SingleBorder();
1919

20+
/// <inheritdoc/>
21+
public override TableBorder SafeBorder { get; } = new Safe();
22+
2023
/// <summary>
2124
/// Get information about the custom border.
2225
/// </summary>
@@ -26,10 +29,31 @@ public override string GetPart(TableBorderPart part)
2629
{
2730
return part switch
2831
{
29-
TableBorderPart.HeaderTop => "-",
30-
TableBorderPart.FooterBottom => "-",
32+
TableBorderPart.HeaderTopLeft => "─",
33+
TableBorderPart.HeaderTop => "─",
34+
TableBorderPart.HeaderTopRight => "─",
35+
TableBorderPart.FooterBottomLeft => "─",
36+
TableBorderPart.FooterBottom => "─",
37+
TableBorderPart.FooterBottomRight => "─",
3138
_ => string.Empty,
3239
};
3340
}
41+
42+
private sealed class Safe : TableBorder
43+
{
44+
public override string GetPart(TableBorderPart part)
45+
{
46+
return part switch
47+
{
48+
TableBorderPart.HeaderTopLeft => "-",
49+
TableBorderPart.HeaderTop => "-",
50+
TableBorderPart.HeaderTopRight => "-",
51+
TableBorderPart.FooterBottomLeft => "-",
52+
TableBorderPart.FooterBottom => "-",
53+
TableBorderPart.FooterBottomRight => "-",
54+
_ => string.Empty,
55+
};
56+
}
57+
}
3458
}
3559
}

0 commit comments

Comments
 (0)