mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 20:53:48 +00:00
Fix the verify job on a fresh checkout
This commit is contained in:
2 files changed
+37
-14
No files matched your search
@@ -784,17 +784,26 @@ jobs:
|
|||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libfuse2 xdg-utils gstreamer1.0-plugins-base gstreamer1.0-plugins-good
|
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libfuse2 xdg-utils gstreamer1.0-plugins-base gstreamer1.0-plugins-good
|
||||||
|
|
||||||
- name: Place a stand-in for the .NET sidecar
|
- name: Place stand-ins for what Tauri's build script expects
|
||||||
run: |
|
run: |
|
||||||
# Tauri's build script copies the .NET app in as a sidecar and refuses to run while that
|
# Tauri's build script insists that everything the configuration lists is already there,
|
||||||
# file is missing, so nothing Rust compiles without it. This job never bundles anything
|
# and refuses to run otherwise -- so nothing Rust compiles without it. Two of those
|
||||||
# and never starts the app; it compiles, tests and lints the Rust code. An empty file is
|
# things are products of a build which has not run here: the .NET app as a sidecar, and
|
||||||
# therefore enough, and publishing the real one would cost minutes for a binary nobody
|
# the PDF library which the build downloads into the resources. The other two resource
|
||||||
# here runs.
|
# directories, notices and tokenizers, are in the repository and need nothing.
|
||||||
|
#
|
||||||
|
# This job never bundles anything and never starts the app; it compiles, tests and lints
|
||||||
|
# the Rust code, and no test opens either file. Empty stand-ins are therefore enough,
|
||||||
|
# while publishing the sidecar and downloading the library would cost minutes for files
|
||||||
|
# nobody here reads. Should a Rust test ever need the real library, this job has to
|
||||||
|
# deploy it the way build_main does instead of placing a stand-in.
|
||||||
mkdir -p "app/MindWork AI Studio/bin/dist"
|
mkdir -p "app/MindWork AI Studio/bin/dist"
|
||||||
touch "app/MindWork AI Studio/bin/dist/mindworkAIStudioServer-x86_64-unknown-linux-gnu"
|
touch "app/MindWork AI Studio/bin/dist/mindworkAIStudioServer-x86_64-unknown-linux-gnu"
|
||||||
chmod +x "app/MindWork AI Studio/bin/dist/mindworkAIStudioServer-x86_64-unknown-linux-gnu"
|
chmod +x "app/MindWork AI Studio/bin/dist/mindworkAIStudioServer-x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
mkdir -p runtime/resources/libraries
|
||||||
|
touch runtime/resources/libraries/stand-in-for-verify.txt
|
||||||
|
|
||||||
- name: Run the quality gate
|
- name: Run the quality gate
|
||||||
run: |
|
run: |
|
||||||
cd "app/Build"
|
cd "app/Build"
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public sealed class VerifyCommand
|
|||||||
};
|
};
|
||||||
|
|
||||||
var runtimeDirectory = Environment.GetRustRuntimeDirectory();
|
var runtimeDirectory = Environment.GetRustRuntimeDirectory();
|
||||||
if (HasSidecar())
|
if (WhatTauriExpectsIsThere())
|
||||||
{
|
{
|
||||||
results.Add(("Rust tests", await CommandRunner.RunAsync(runtimeDirectory, "cargo", "test")));
|
results.Add(("Rust tests", await CommandRunner.RunAsync(runtimeDirectory, "cargo", "test")));
|
||||||
results.Add(("Clippy", await CommandRunner.RunAsync(runtimeDirectory, "cargo", "clippy --all-targets -- -D warnings")));
|
results.Add(("Clippy", await CommandRunner.RunAsync(runtimeDirectory, "cargo", "clippy --all-targets -- -D warnings")));
|
||||||
@@ -43,12 +43,13 @@ public sealed class VerifyCommand
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Tauri's build script copies the .NET app in as a sidecar and refuses to run at all
|
// Tauri's build script insists that everything the configuration lists is already
|
||||||
// while that file is missing, so nothing Rust compiles without it. Failing here would
|
// there and refuses to run otherwise, so nothing Rust compiles until a build has
|
||||||
// be a trap rather than a gate: the way to produce the sidecar is `dotnet run build`,
|
// produced those files once. Failing here would be a trap rather than a gate: the way
|
||||||
// and that command runs this gate first -- a fresh clone would never get past it.
|
// to produce them is `dotnet run build`, and that command runs this gate first -- a
|
||||||
|
// fresh clone would never get past it.
|
||||||
//
|
//
|
||||||
Console.WriteLine("- Skipping the Rust tests and Clippy: the .NET sidecar is missing, and Tauri's build script needs it before anything Rust compiles.");
|
Console.WriteLine("- Skipping the Rust tests and Clippy: the .NET sidecar or the downloaded libraries are missing, and Tauri's build script needs both before anything Rust compiles.");
|
||||||
Console.WriteLine(" Run 'dotnet run build --skip-verify' once. From then on, this part of the gate runs with the rest.");
|
Console.WriteLine(" Run 'dotnet run build --skip-verify' once. From then on, this part of the gate runs with the rest.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,9 +71,22 @@ public sealed class VerifyCommand
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool HasSidecar()
|
/// <summary>
|
||||||
|
/// Whether a build has already produced the files Tauri's build script reads.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Both are products of a build rather than of the repository: the .NET app arrives as a
|
||||||
|
/// sidecar, and the PDF library is downloaded into the resources. The other resource
|
||||||
|
/// directories the configuration names are in the repository and are always there.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>True, when cargo can get past the build script.</returns>
|
||||||
|
private static bool WhatTauriExpectsIsThere()
|
||||||
{
|
{
|
||||||
var distributionDirectory = Path.Combine(Environment.GetAIStudioDirectory(), "bin", "dist");
|
var distributionDirectory = Path.Combine(Environment.GetAIStudioDirectory(), "bin", "dist");
|
||||||
return Directory.Exists(distributionDirectory) && Directory.EnumerateFiles(distributionDirectory, $"{SIDECAR_PREFIX}*").Any();
|
if (!Directory.Exists(distributionDirectory) || !Directory.EnumerateFiles(distributionDirectory, $"{SIDECAR_PREFIX}*").Any())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var librariesDirectory = Path.Combine(Environment.GetRustRuntimeDirectory(), "resources", "libraries");
|
||||||
|
return Directory.Exists(librariesDirectory) && Directory.EnumerateFiles(librariesDirectory).Any();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user