mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 09:07:21 +00:00
Fixed chats not loading in the v26.10.1 pre-release and added a trim smoke test (#1128)
This commit is contained in:
1 parent
7b9e96d6a1
commit
fd0a42fa8a
12 files changed
+346
-14
No files matched your search
@@ -1,5 +1,7 @@
|
||||
using Build.Tools;
|
||||
|
||||
using SharedTools;
|
||||
|
||||
// ReSharper disable ClassNeverInstantiated.Global
|
||||
// ReSharper disable UnusedType.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
@@ -20,7 +22,7 @@ public sealed class VerifyCommand
|
||||
/// </summary>
|
||||
private const string SIDECAR_PREFIX = "mindworkAIStudioServer-";
|
||||
|
||||
[Command("verify", Description = "Run the quality gate: .NET tests, Rust tests, Clippy, and the model sources")]
|
||||
[Command("verify", Description = "Run the quality gate: .NET tests, the trim smoke test, Rust tests, Clippy, and the model sources")]
|
||||
public async Task<int> Verify()
|
||||
{
|
||||
if(!Environment.IsWorkingDirectoryValid())
|
||||
@@ -32,6 +34,7 @@ public sealed class VerifyCommand
|
||||
var results = new List<(string What, int ExitCode)>
|
||||
{
|
||||
(".NET tests", await CommandRunner.RunAsync(Environment.GetTestsDirectory(), "dotnet", "test --nologo")),
|
||||
("Trim smoke test", await RunTrimSmokeTestAsync()),
|
||||
};
|
||||
|
||||
var runtimeDirectory = Environment.GetRustRuntimeDirectory();
|
||||
@@ -71,6 +74,34 @@ public sealed class VerifyCommand
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Publishes the trim smoke test for this machine, trimmed like the app, and runs it.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Debug builds and the tests are not trimmed, so only a published build shows that the trimmer
|
||||
/// removed code which System.Text.Json reaches by reflection. Then AI Studio can neither load nor
|
||||
/// save, e.g., its chats, while everything looks fine during development.
|
||||
/// </remarks>
|
||||
/// <returns>The exit code of the publishing, when that failed; otherwise the one of the smoke test.</returns>
|
||||
private static async Task<int> RunTrimSmokeTestAsync()
|
||||
{
|
||||
var rid = Environment.GetCurrentRid();
|
||||
if (rid is RID.NONE)
|
||||
{
|
||||
Console.WriteLine("- Error: The trim smoke test needs a platform AI Studio is built for.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
var directory = Environment.GetTrimSmokeTestDirectory();
|
||||
var publishDirectory = Path.Combine(directory, "bin", "verify");
|
||||
var publishExitCode = await CommandRunner.RunAsync(directory, "dotnet", $"publish --configuration release --runtime {rid.AsMicrosoftRid()} --output \"{publishDirectory}\" --nologo");
|
||||
if (publishExitCode is not 0)
|
||||
return publishExitCode;
|
||||
|
||||
var program = Path.Combine(publishDirectory, OperatingSystem.IsWindows() ? "TrimSmokeTest.exe" : "TrimSmokeTest");
|
||||
return await CommandRunner.RunAsync(directory, program, string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether a build has already produced the files Tauri's build script reads.
|
||||
/// </summary>
|
||||
|
||||
@@ -41,6 +41,13 @@ public static class Environment
|
||||
return Path.GetFullPath(directory);
|
||||
}
|
||||
|
||||
public static string GetTrimSmokeTestDirectory()
|
||||
{
|
||||
var currentDirectory = Directory.GetCurrentDirectory();
|
||||
var directory = Path.Combine(currentDirectory, "..", "TrimSmokeTest");
|
||||
return Path.GetFullPath(directory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The root of the git repository, which is what a path in a report is written relative to.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user