Skip to content

Commit 94411c5

Browse files
committed
Upgrade to NUKE 8
* tweak code to get rid of warnings * ensure deterministic build for CI * use fixed paths for test resource loading * ensure test errors are shown on GH Actions UI
1 parent 8aceda9 commit 94411c5

File tree

10 files changed

+37
-31
lines changed

10 files changed

+37
-31
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- uses: actions/checkout@v4
5252

5353
- name: Setup dotnet
54-
uses: actions/setup-dotnet@v3
54+
uses: actions/setup-dotnet@v4
5555
with:
5656
dotnet-version: |
5757
6.0.x
@@ -68,7 +68,7 @@ jobs:
6868
- uses: actions/checkout@v4
6969

7070
- name: Setup dotnet
71-
uses: actions/setup-dotnet@v3
71+
uses: actions/setup-dotnet@v4
7272
with:
7373
dotnet-version: |
7474
6.0.x

.nuke/build.schema.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "http://json-schema.org/draft-04/schema#",
3-
"title": "Build Schema",
43
"$ref": "#/definitions/build",
4+
"title": "Build Schema",
55
"definitions": {
66
"build": {
77
"type": "object",
@@ -131,4 +131,4 @@
131131
}
132132
}
133133
}
134-
}
134+
}

build.cmd

100644100755
File mode changed.

build.ps1

+8-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ $TempDirectory = "$PSScriptRoot\\.nuke\temp"
1818

1919
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
2020
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
21-
$DotNetChannel = "Current"
21+
$DotNetChannel = "STS"
2222

23-
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
2423
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
25-
$env:DOTNET_MULTILEVEL_LOOKUP = 0
24+
$env:DOTNET_NOLOGO = 1
2625

2726
###########################################################################
2827
# EXECUTION
@@ -61,9 +60,15 @@ else {
6160
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
6261
}
6362
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
63+
$env:PATH = "$DotNetDirectory;$env:PATH"
6464
}
6565

6666
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
6767

68+
if (Test-Path env:NUKE_ENTERPRISE_TOKEN) {
69+
& $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null
70+
& $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null
71+
}
72+
6873
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
6974
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }

build.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"
1414

1515
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
1616
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
17-
DOTNET_CHANNEL="Current"
17+
DOTNET_CHANNEL="STS"
1818

1919
export DOTNET_CLI_TELEMETRY_OPTOUT=1
20-
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
21-
export DOTNET_MULTILEVEL_LOOKUP=0
20+
export DOTNET_NOLOGO=1
2221

2322
###########################################################################
2423
# EXECUTION
@@ -54,9 +53,15 @@ else
5453
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
5554
fi
5655
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
56+
export PATH="$DOTNET_DIRECTORY:$PATH"
5757
fi
5858

5959
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"
6060

61+
if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then
62+
"$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true
63+
"$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true
64+
fi
65+
6166
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
6267
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"

nuke/Build.cs

+9-6
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected override void OnBuildInitialized()
100100

101101
Log.Information("Building version: {Version}", Version);
102102

103-
TargetProject = Solution.GetProject(SourceDirectory / TargetProjectName / $"{TargetLibName}.csproj" );
103+
TargetProject = Solution.GetProject(TargetLibName);
104104
TargetProject.NotNull("TargetProject could not be loaded!");
105105

106106
TargetFrameworks = TargetProject.GetTargetFrameworks();
@@ -113,7 +113,7 @@ protected override void OnBuildInitialized()
113113
.Before(Restore)
114114
.Executes(() =>
115115
{
116-
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
116+
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory());
117117
});
118118

119119
Target Restore => _ => _
@@ -130,6 +130,7 @@ protected override void OnBuildInitialized()
130130
DotNetBuild(s => s
131131
.SetProjectFile(Solution)
132132
.SetConfiguration(Configuration)
133+
.SetContinuousIntegrationBuild(IsServerBuild)
133134
.EnableNoRestore());
134135
});
135136

@@ -143,6 +144,7 @@ protected override void OnBuildInitialized()
143144
.EnableNoRestore()
144145
.EnableNoBuild()
145146
.SetProcessEnvironmentVariable("prefetched", "false")
147+
.When(GitHubActions.Instance is not null, x => x.SetLoggers("GitHubActions"))
146148
);
147149

148150
DotNetTest(s => s
@@ -151,6 +153,7 @@ protected override void OnBuildInitialized()
151153
.EnableNoRestore()
152154
.EnableNoBuild()
153155
.SetProcessEnvironmentVariable("prefetched", "true")
156+
.When(GitHubActions.Instance is not null, x => x.SetLoggers("GitHubActions"))
154157
);
155158
});
156159

@@ -183,9 +186,9 @@ protected override void OnBuildInitialized()
183186
.SetTargetPath(nuspec)
184187
.SetVersion(Version)
185188
.SetOutputDirectory(NugetDirectory)
186-
.SetSymbols(true)
187-
.SetSymbolPackageFormat("snupkg")
188-
.AddProperty("Configuration", Configuration)
189+
.EnableSymbols()
190+
.SetSymbolPackageFormat(NuGetSymbolPackageFormat.snupkg)
191+
.SetConfiguration(Configuration)
189192
);
190193
});
191194

@@ -202,7 +205,7 @@ protected override void OnBuildInitialized()
202205
throw new BuildAbortedException("Could not resolve the NuGet API key.");
203206
}
204207

205-
foreach (var nupkg in GlobFiles(NugetDirectory, "*.nupkg"))
208+
foreach (var nupkg in NugetDirectory.GlobFiles("*.nupkg"))
206209
{
207210
NuGetPush(s => s
208211
.SetTargetPath(nupkg)

nuke/_build.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<RootNamespace></RootNamespace>
77
<NoWarn>CS0649;CS0169</NoWarn>
88
<NukeRootDirectory>..</NukeRootDirectory>
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Nuke.Common" Version="6.2.1" />
14+
<PackageReference Include="Nuke.Common" Version="8.0.0" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

src/AngleSharp.Benchmarks/AngleSharp.Benchmarks.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<OutputType>Exe</OutputType>
44
<TargetFrameworks>net472;net6.0;net8.0</TargetFrameworks>
55
<SignAssembly>false</SignAssembly>
6+
<IsPackable>false</IsPackable>
67
</PropertyGroup>
78

89
<ItemGroup>

src/AngleSharp.Core.Tests/AngleSharp.Core.Tests.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@
3838
<ItemGroup>
3939
<None Remove="Html\BrokenMail.txt" />
4040
</ItemGroup>
41+
42+
<ItemGroup>
43+
<Content Include="Resources\*" CopyToOutputDirectory="PreserveNewest" />
44+
</ItemGroup>
4145
</Project>

src/AngleSharp.Core.Tests/External/PageRequester.cs

+1-13
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,15 @@ namespace AngleSharp.Core.Tests.External
55
using System;
66
using System.IO;
77
using System.Net;
8-
using System.Runtime.CompilerServices;
98
using System.Threading;
109
using System.Threading.Tasks;
1110

1211
sealed class PageRequester : BaseRequester
1312
{
1413
private readonly static DefaultHttpRequester _default = new DefaultHttpRequester();
15-
private readonly static String _directory = GetResourceDirectory();
14+
private readonly static String _directory = "Resources";
1615
private readonly static SiteMapping _mapping = new SiteMapping(Path.Combine(_directory, "content.xml"));
1716

18-
private static String GetResourceDirectory( [CallerFilePath] String fileName = null )
19-
{
20-
var directoryPath = Path.Combine(Path.GetDirectoryName(fileName), "..", "Resources");
21-
if (!Directory.Exists(directoryPath))
22-
{
23-
Directory.CreateDirectory(directoryPath);
24-
}
25-
26-
return directoryPath;
27-
}
28-
2917
public override Boolean SupportsProtocol(String protocol)
3018
{
3119
return _default.SupportsProtocol(protocol);

0 commit comments

Comments
 (0)