Skip to content

Commit 1ab1301

Browse files
authored
Upgrade nuget refs and add macOS to GitHub Actions workflows (#59)
* Replace FluentAssertions with AwesomeAssertions and update various NuGet dependencies across projects. * Upgrade Microsoft.NET.Test.Sdk to version 18.0.0 across all test projects. * Add macOS support to GitHub Actions workflows and enhance platform coverage across integration, pull-request, and main CI/CD workflows. * Restrict artifact publishing to Linux runners in workflows and Build.cs. * Enhance GitHub Actions environment checks: add `IsLocalBuild` and `GetRunnerOs` methods, update `SkipPush` logic in `Build.cs` to enforce stricter conditions. * Add Serilog and log build initialization information in Build.cs * Refactor: Simplify array creation in Build.cs and enforce stricter null checks in GitHubActionsExtensions. * Reduce Thread.Sleep duration in cache tests to improve test execution time * Refactor cache tests to use async/await instead of Thread.Sleep * Comment out `Task.Delay` calls in caching tests to improve test execution time. * Standardize caching logic to use `DateTime.UtcNow` instead of `DateTime.Now` and adjust test timing for consistency and reliability. * Add debug logging for cache expiry checks in sliding time span mode * Comment out debug logging for sliding time span cache expiry checks. * Remove sliding time span cache expiration policy and related tests. * Improve code readability and consistency across files by standardizing temporary file path handling, enabling stricter nullability checks, replacing outdated patterns, and refining async/await usage in tests. * Refactor: Improve null handling, simplify array assignments, and enhance code readability across multiple files * Update package references to latest versions across projects for improved compatibility and reliability. * Update package references to latest versions across projects for compatibility and reliability improvements. * Remove redundant package references and enhance logging configuration in tests.
1 parent d27f693 commit 1ab1301

148 files changed

Lines changed: 428 additions & 449 deletions

File tree

Some content is hidden

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

.github/workflows/integration.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,55 @@ jobs:
4242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4343
- name: 'Publish: coverage_report'
4444
uses: actions/upload-artifact@v4
45+
if: runner.os == 'Linux'
46+
with:
47+
name: coverage_report
48+
path: .tests/coverage_report
49+
windows-latest:
50+
name: windows-latest
51+
runs-on: windows-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
with:
55+
fetch-depth: 0
56+
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
57+
uses: actions/cache@v4
58+
with:
59+
path: |
60+
.nuke/temp
61+
~/.nuget/packages
62+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
63+
- name: 'Run: DeployNuGet'
64+
run: ./build.cmd DeployNuGet
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
- name: 'Publish: coverage_report'
68+
uses: actions/upload-artifact@v4
69+
if: runner.os == 'Linux'
70+
with:
71+
name: coverage_report
72+
path: .tests/coverage_report
73+
macos-latest:
74+
name: macos-latest
75+
runs-on: macos-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
with:
79+
fetch-depth: 0
80+
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
81+
uses: actions/cache@v4
82+
with:
83+
path: |
84+
.nuke/temp
85+
~/.nuget/packages
86+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
87+
- name: 'Run: DeployNuGet'
88+
run: ./build.cmd DeployNuGet
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
- name: 'Publish: coverage_report'
92+
uses: actions/upload-artifact@v4
93+
if: runner.os == 'Linux'
4594
with:
4695
name: coverage_report
4796
path: .tests/coverage_report

.github/workflows/main.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,55 @@ jobs:
4242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4343
- name: 'Publish: coverage_report'
4444
uses: actions/upload-artifact@v4
45+
if: runner.os == 'Linux'
46+
with:
47+
name: coverage_report
48+
path: .tests/coverage_report
49+
windows-latest:
50+
name: windows-latest
51+
runs-on: windows-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
with:
55+
fetch-depth: 0
56+
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
57+
uses: actions/cache@v4
58+
with:
59+
path: |
60+
.nuke/temp
61+
~/.nuget/packages
62+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
63+
- name: 'Run: DeployNuGet'
64+
run: ./build.cmd DeployNuGet
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
- name: 'Publish: coverage_report'
68+
uses: actions/upload-artifact@v4
69+
if: runner.os == 'Linux'
70+
with:
71+
name: coverage_report
72+
path: .tests/coverage_report
73+
macos-latest:
74+
name: macos-latest
75+
runs-on: macos-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
with:
79+
fetch-depth: 0
80+
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
81+
uses: actions/cache@v4
82+
with:
83+
path: |
84+
.nuke/temp
85+
~/.nuget/packages
86+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
87+
- name: 'Run: DeployNuGet'
88+
run: ./build.cmd DeployNuGet
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
- name: 'Publish: coverage_report'
92+
uses: actions/upload-artifact@v4
93+
if: runner.os == 'Linux'
4594
with:
4695
name: coverage_report
4796
path: .tests/coverage_report

.github/workflows/pull-request.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,27 @@ jobs:
7070
with:
7171
name: coverage_report
7272
path: .tests/coverage_report
73+
macos-latest:
74+
name: macos-latest
75+
runs-on: macos-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
with:
79+
fetch-depth: 0
80+
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
81+
uses: actions/cache@v4
82+
with:
83+
path: |
84+
.nuke/temp
85+
~/.nuget/packages
86+
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
87+
- name: 'Run: Rebuild, CodeCoverage, Pack'
88+
run: ./build.cmd Rebuild CodeCoverage Pack
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
- name: 'Publish: coverage_report'
92+
uses: actions/upload-artifact@v4
93+
if: runner.os == 'Linux'
94+
with:
95+
name: coverage_report
96+
path: .tests/coverage_report

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ ClientBin/
216216
*.publishsettings
217217
orleans.codegen.cs
218218

219-
# Including strong name files can present a security risk
219+
# Including strong name files can present a security risk
220220
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
221221
#*.snk
222222

@@ -313,7 +313,7 @@ __pycache__/
313313
# OpenCover UI analysis results
314314
OpenCover/
315315

316-
# Azure Stream Analytics local run output
316+
# Azure Stream Analytics local run output
317317
ASALocalRun/
318318

319319
# MSBuild Binary and Structured Log
@@ -326,3 +326,5 @@ ASALocalRun/
326326
.tests
327327

328328
.nuke
329+
330+
.DS_Store

build/Build.cs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using CreativeCoders.Core;
55
using CreativeCoders.Core.Collections;
66
using CreativeCoders.NukeBuild.BuildActions;
7+
using CreativeCoders.NukeBuild.Components;
78
using CreativeCoders.NukeBuild.Components.Parameters;
89
using CreativeCoders.NukeBuild.Components.Targets;
910
using CreativeCoders.NukeBuild.Components.Targets.Settings;
@@ -13,31 +14,37 @@
1314
using Nuke.Common.Execution;
1415
using Nuke.Common.IO;
1516
using Nuke.Common.ProjectModel;
17+
using Serilog;
1618

1719
#pragma warning disable S1144 // remove unused private members
1820
#pragma warning disable S3903 // move class to namespace
1921
[PublicAPI]
2022
[UnsetVisualStudioEnvironmentVariables]
21-
[GitHubActions("integration", GitHubActionsImage.UbuntuLatest,
23+
[GitHubActions("integration",
24+
GitHubActionsImage.UbuntuLatest, GitHubActionsImage.WindowsLatest, GitHubActionsImage.MacOsLatest,
2225
OnPushBranches = ["feature/**"],
2326
InvokedTargets = [NukeTargets.DeployNuGet],
2427
EnableGitHubToken = true,
2528
PublishArtifacts = true,
29+
PublishCondition = "runner.os == 'Linux'",
2630
FetchDepth = 0
2731
)]
28-
[GitHubActions("pull-request", GitHubActionsImage.UbuntuLatest, GitHubActionsImage.WindowsLatest,
32+
[GitHubActions("pull-request",
33+
GitHubActionsImage.UbuntuLatest, GitHubActionsImage.WindowsLatest, GitHubActionsImage.MacOsLatest,
2934
OnPullRequestBranches = ["main"],
3035
InvokedTargets = [NukeTargets.Rebuild, NukeTargets.CodeCoverage, NukeTargets.Pack],
3136
EnableGitHubToken = true,
3237
PublishArtifacts = true,
3338
PublishCondition = "runner.os == 'Linux'",
3439
FetchDepth = 0
3540
)]
36-
[GitHubActions("main", GitHubActionsImage.UbuntuLatest,
41+
[GitHubActions("main",
42+
GitHubActionsImage.UbuntuLatest, GitHubActionsImage.WindowsLatest, GitHubActionsImage.MacOsLatest,
3743
OnPushBranches = ["main"],
3844
InvokedTargets = [NukeTargets.DeployNuGet],
3945
EnableGitHubToken = true,
4046
PublishArtifacts = true,
47+
PublishCondition = "runner.os == 'Linux'",
4148
FetchDepth = 0
4249
)]
4350
[GitHubActions(ReleaseWorkflow, GitHubActionsImage.UbuntuLatest,
@@ -71,7 +78,8 @@ class Build : NukeBuild,
7178

7279
public IEnumerable<Project> TestProjects => GetTestProjects();
7380

74-
bool IPushNuGetSettings.SkipPush => GitHubActions?.IsPullRequest == true;
81+
bool IPushNuGetSettings.SkipPush => GitHubActions?.IsPullRequest == true ||
82+
!(GitHubActions.IsLocalBuild() || GitHubActions?.GetRunnerOs() == GitHubActionsRunnerOs.Linux);
7583

7684
string IPushNuGetSettings.NuGetFeedUrl =>
7785
GitHubActions?.Workflow == ReleaseWorkflow
@@ -93,7 +101,16 @@ Project[] GetTestProjects() =>
93101
this.TryAs<ISolutionParameter>(out var solutionParameter)
94102
? solutionParameter.Solution.GetAllProjects("*")
95103
.Where(x => ((string)x.Path)?.StartsWith(RootDirectory / "tests") ?? false).ToArray()
96-
: Array.Empty<Project>();
104+
: [];
97105

98106
public static int Main() => Execute<Build>(x => ((ICodeCoverageTarget)x).CodeCoverage);
107+
108+
protected override void OnBuildInitialized()
109+
{
110+
base.OnBuildInitialized();
111+
112+
Log.Information("Build initialized");
113+
Log.Information("Skip Nuget Push: {SkipPush}", (this as IPushNuGetSettings).SkipPush);
114+
115+
}
99116
}

build/_build.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Nuke.Common" Version="9.0.4" />
16-
<PackageReference Include="ReportGenerator" Version="5.4.9"/>
16+
<PackageReference Include="ReportGenerator" Version="5.4.16"/>
1717
<PackageDownload Include="GitVersion.Tool" Version="[5.12.0]"/>
1818
</ItemGroup>
1919

samples/BlazorWebAssemblySampleApp/BlazorWebAssemblySampleApp.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.18" />
9-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.18" PrivateAssets="all" />
10-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.18" />
8+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.20"/>
9+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.20" PrivateAssets="all"/>
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.20"/>
1111
</ItemGroup>
1212

1313
<ItemGroup>

samples/BlazorWebAssemblySampleApp/Shared/LoginDisplay.razor

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
33

44
@inject NavigationManager Navigation
5-
@inject SignOutSessionStateManager SignOutManager
65

76
<AuthorizeView>
87
<Authorized>
@@ -16,10 +15,9 @@
1615

1716
@code{
1817

19-
private async Task BeginSignOut(MouseEventArgs args)
18+
private void BeginSignOut(MouseEventArgs args)
2019
{
21-
await SignOutManager.SetSignOutState();
22-
Navigation.NavigateTo("authentication/logout");
20+
Navigation.NavigateToLogout("authentication/logout");
2321
}
2422

2523
}

samples/NetSampleApp/NetSampleApp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.10"/>
9+
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.20"/>
1010
</ItemGroup>
1111

1212
<ItemGroup>

source/AspNetCore/CreativeCoders.AspNetCore.Blazor/CreativeCoders.AspNetCore.Blazor.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.18" />
11-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.18" />
12-
<PackageReference Include="Microsoft.JSInterop" Version="8.0.18" />
10+
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.20"/>
11+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.20" />
12+
<PackageReference Include="Microsoft.JSInterop" Version="8.0.20"/>
1313
</ItemGroup>
1414

1515

0 commit comments

Comments
 (0)