Fix dnx random failures (#20284)

* Try to fix dnx random failure

* Use full paths for WebAppDir everywhere

* Call dnx explicitly on CI

---------

Co-authored-by: Max Katz <maxkatz6@outlook.com>
This commit is contained in:
Julien Lebosquain
2025-12-16 12:55:58 +01:00
committed by GitHub
parent 79be86d923
commit 37526dc904
5 changed files with 22 additions and 7 deletions
+1
View File
@@ -35,6 +35,7 @@
"CreateNugetPackages", "CreateNugetPackages",
"DownloadApiBaselinePackages", "DownloadApiBaselinePackages",
"GenerateCppHeaders", "GenerateCppHeaders",
"InitDnx",
"OutputApiDiff", "OutputApiDiff",
"OutputVersion", "OutputVersion",
"Package", "Package",
+16 -2
View File
@@ -57,6 +57,7 @@ partial class Build : NukeBuild
Information("Repository Name: " + Parameters.RepositoryName); Information("Repository Name: " + Parameters.RepositoryName);
Information("Repository Branch: " + Parameters.RepositoryBranch); Information("Repository Branch: " + Parameters.RepositoryBranch);
} }
Information("Configuration: " + Parameters.Configuration); Information("Configuration: " + Parameters.Configuration);
Information("IsLocalBuild: " + Parameters.IsLocalBuild); Information("IsLocalBuild: " + Parameters.IsLocalBuild);
Information("IsRunningOnUnix: " + Parameters.IsRunningOnUnix); Information("IsRunningOnUnix: " + Parameters.IsRunningOnUnix);
@@ -73,8 +74,9 @@ partial class Build : NukeBuild
void ExecWait(string preamble, string command, string args) void ExecWait(string preamble, string command, string args)
{ {
Console.WriteLine(preamble); Console.WriteLine(preamble);
Process.Start(new ProcessStartInfo(command, args) {UseShellExecute = false}).WaitForExit(); Process.Start(new ProcessStartInfo(command, args) { UseShellExecute = false }).WaitForExit();
} }
ExecWait("dotnet version:", "dotnet", "--info"); ExecWait("dotnet version:", "dotnet", "--info");
ExecWait("dotnet workloads:", "dotnet", "workload list"); ExecWait("dotnet workloads:", "dotnet", "workload list");
Information("Processor count: " + Environment.ProcessorCount); Information("Processor count: " + Environment.ProcessorCount);
@@ -99,6 +101,7 @@ partial class Build : NukeBuild
.AddProperty("SkipBuildingTests", "True"); .AddProperty("SkipBuildingTests", "True");
return c; return c;
} }
DotNetBuildSettings ApplySetting(DotNetBuildSettings c, Configure<DotNetBuildSettings> configurator = null) => DotNetBuildSettings ApplySetting(DotNetBuildSettings c, Configure<DotNetBuildSettings> configurator = null) =>
ApplySettingCore(c).Build.Apply(configurator); ApplySettingCore(c).Build.Apply(configurator);
@@ -129,6 +132,17 @@ partial class Build : NukeBuild
} }
}); });
// Ensure that Bun.Official.Tool is downloaded at least once on CI to work around https://github.com/dotnet/sdk/issues/51831
Target InitDnx => _ => _
.Executes(() =>
{
var process = ProcessTasks.StartProcess(
"dnx",
"Bun.Unofficial.Tool --yes -- install",
$"{RootDirectory}/src/Browser/Avalonia.Browser/webapp");
process.AssertZeroExitCode();
});
Target CompileNative => _ => _ Target CompileNative => _ => _
.DependsOn(Clean) .DependsOn(Clean)
.DependsOn(GenerateCppHeaders) .DependsOn(GenerateCppHeaders)
@@ -141,7 +155,7 @@ partial class Build : NukeBuild
}); });
Target Compile => _ => _ Target Compile => _ => _
.DependsOn(Clean, CompileNative) .DependsOn(Clean, CompileNative, InitDnx)
.Executes(() => .Executes(() =>
{ {
DotNetBuild(c => ApplySetting(c) DotNetBuild(c => ApplySetting(c)
@@ -10,7 +10,7 @@
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NugetPackageName>Avalonia</NugetPackageName> <NugetPackageName>Avalonia</NugetPackageName>
<WebAppDir>Remote\HtmlTransport\webapp</WebAppDir> <WebAppDir>$(MSBuildThisFileDirectory)Remote/HtmlTransport/webapp</WebAppDir>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Remote\HtmlTransport\webapp\build\**\*.gz" /> <EmbeddedResource Include="Remote\HtmlTransport\webapp\build\**\*.gz" />
@@ -3,7 +3,7 @@
<TargetFrameworks>$(AvsCurrentTargetFramework);$(AvsCurrentBrowserTargetFramework)</TargetFrameworks> <TargetFrameworks>$(AvsCurrentTargetFramework);$(AvsCurrentBrowserTargetFramework)</TargetFrameworks>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WebAppDir>webapp</WebAppDir> <WebAppDir>$(MSBuildThisFileDirectory)webapp</WebAppDir>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework> <TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<WebAppDir>Remote\HtmlTransport\webapp</WebAppDir> <WebAppDir>$(MSBuildThisFileDirectory)Remote/HtmlTransport/webapp</WebAppDir>
</PropertyGroup> </PropertyGroup>
<Import Project="..\..\build\UnitTests.NetCore.targets" /> <Import Project="..\..\build\UnitTests.NetCore.targets" />
<Import Project="..\..\build\Moq.props" /> <Import Project="..\..\build\Moq.props" />