Tighten Windows desktop smoke loop

This commit is contained in:
Mohamed Boudra
2026-03-10 19:22:54 +07:00
parent 2813f35eb1
commit f09b43eef0
2 changed files with 34 additions and 14 deletions
+1 -1
View File
@@ -432,7 +432,7 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
app_path="packages/desktop/src-tauri/target/release/Paseo.exe" app_path="packages/desktop/src-tauri/target/release/Paseo.exe"
if npm run tauri --workspace=@getpaseo/desktop build; then if npm run tauri --workspace=@getpaseo/desktop build -- --no-bundle; then
exit 0 exit 0
fi fi
if [[ -f "$app_path" ]]; then if [[ -f "$app_path" ]]; then
@@ -11,6 +11,7 @@ import WebSocket from "ws";
import { createClientChannel } from "@getpaseo/relay/e2ee"; import { createClientChannel } from "@getpaseo/relay/e2ee";
const execFileAsync = promisify(execFile); const execFileAsync = promisify(execFile);
const COMMAND_TIMEOUT_MS = 120_000;
const repoRoot = fileURLToPath(new URL("../../..", import.meta.url)); const repoRoot = fileURLToPath(new URL("../../..", import.meta.url));
const desktopRoot = path.join(repoRoot, "packages", "desktop"); const desktopRoot = path.join(repoRoot, "packages", "desktop");
const relayRoot = path.join(repoRoot, "packages", "relay"); const relayRoot = path.join(repoRoot, "packages", "relay");
@@ -109,13 +110,29 @@ function escapeForRegExp(value) {
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
} }
async function execFileWithTimeout(command, args, options, label) {
try {
return await execFileAsync(command, args, {
timeout: COMMAND_TIMEOUT_MS,
...options,
});
} catch (error) {
if (error?.killed && error?.signal === "SIGTERM") {
const renderedArgs = args.map((arg) => JSON.stringify(arg)).join(" ");
throw new Error(
`Timed out after ${COMMAND_TIMEOUT_MS}ms running ${label}: ${JSON.stringify(command)} ${renderedArgs}`
);
}
throw error;
}
}
async function runBinary(binaryPath, args, env) { async function runBinary(binaryPath, args, env) {
const { stdout, stderr } = await execFileAsync(binaryPath, args, { const { stdout, stderr } = await execFileWithTimeout(binaryPath, args, {
env, env,
cwd: repoRoot, cwd: repoRoot,
maxBuffer: 10 * 1024 * 1024, maxBuffer: 10 * 1024 * 1024,
}); }, "packaged desktop binary");
const trimmed = stdout.trim(); const trimmed = stdout.trim();
return { return {
stdout, stdout,
@@ -125,7 +142,7 @@ async function runBinary(binaryPath, args, env) {
} }
async function runWorkspaceCli(args, env) { async function runWorkspaceCli(args, env) {
const { stdout, stderr } = await execFileAsync( const { stdout, stderr } = await execFileWithTimeout(
process.execPath, process.execPath,
[path.join(repoRoot, "packages", "cli", "dist", "index.js"), ...args], [path.join(repoRoot, "packages", "cli", "dist", "index.js"), ...args],
{ {
@@ -136,6 +153,7 @@ async function runWorkspaceCli(args, env) {
}, },
maxBuffer: 10 * 1024 * 1024, maxBuffer: 10 * 1024 * 1024,
}, },
"workspace CLI"
); );
let json = null; let json = null;
if (stdout.trim()) { if (stdout.trim()) {
@@ -152,7 +170,7 @@ async function runBundledRuntimeCli(runtimeRoot, managedHome, args, env) {
const manifest = JSON.parse( const manifest = JSON.parse(
await fs.readFile(path.join(runtimeRoot, "runtime-manifest.json"), "utf8") await fs.readFile(path.join(runtimeRoot, "runtime-manifest.json"), "utf8")
); );
const { stdout, stderr } = await execFileAsync( const { stdout, stderr } = await execFileWithTimeout(
path.join(runtimeRoot, manifest.nodeRelativePath), path.join(runtimeRoot, manifest.nodeRelativePath),
[path.join(runtimeRoot, manifest.cliEntrypointRelativePath), ...args], [path.join(runtimeRoot, manifest.cliEntrypointRelativePath), ...args],
{ {
@@ -163,7 +181,8 @@ async function runBundledRuntimeCli(runtimeRoot, managedHome, args, env) {
PASEO_HOME: managedHome, PASEO_HOME: managedHome,
}, },
maxBuffer: 10 * 1024 * 1024, maxBuffer: 10 * 1024 * 1024,
} },
"bundled runtime CLI"
); );
return { stdout, stderr }; return { stdout, stderr };
} }
@@ -367,11 +386,11 @@ async function ensurePackagedArtifact(binaryPath) {
throw new Error("npm_execpath is required to build the packaged desktop artifact during smoke tests."); throw new Error("npm_execpath is required to build the packaged desktop artifact during smoke tests.");
} }
try { try {
await execFileAsync(process.execPath, [npmExecPath, "run", "build"], { await execFileWithTimeout(process.execPath, [npmExecPath, "run", "build"], {
cwd: desktopRoot, cwd: desktopRoot,
env: process.env, env: process.env,
maxBuffer: 20 * 1024 * 1024, maxBuffer: 20 * 1024 * 1024,
}); }, "desktop smoke artifact build");
} catch (error) { } catch (error) {
const combined = `${error.stdout ?? ""}\n${error.stderr ?? ""}`; const combined = `${error.stdout ?? ""}\n${error.stderr ?? ""}`;
const signingBlocked = const signingBlocked =
@@ -620,11 +639,11 @@ try {
logStep("Skipping privileged CLI shim install in CI and verifying the bundled CLI target directly"); logStep("Skipping privileged CLI shim install in CI and verifying the bundled CLI target directly");
} }
const cliVersion = cliShimInstalled const cliVersion = cliShimInstalled
? await execFileAsync(cliShimPath, ["--version"], { ? await execFileWithTimeout(cliShimPath, ["--version"], {
env: managedEnv, env: managedEnv,
cwd: repoRoot, cwd: repoRoot,
maxBuffer: 1024 * 1024, maxBuffer: 1024 * 1024,
}) }, "installed CLI shim version check")
: await runBundledRuntimeCli( : await runBundledRuntimeCli(
runtimeStatus.json.runtimeRoot, runtimeStatus.json.runtimeRoot,
managedStart.managedHome, managedStart.managedHome,
@@ -633,11 +652,11 @@ try {
); );
assert.match(cliVersion.stdout.trim(), /^0\./); assert.match(cliVersion.stdout.trim(), /^0\./);
const shimStatus = cliShimInstalled const shimStatus = cliShimInstalled
? await execFileAsync(cliShimPath, ["daemon", "status", "--json"], { ? await execFileWithTimeout(cliShimPath, ["daemon", "status", "--json"], {
env: managedEnv, env: managedEnv,
cwd: repoRoot, cwd: repoRoot,
maxBuffer: 1024 * 1024, maxBuffer: 1024 * 1024,
}) }, "installed CLI shim daemon status")
: await runBundledRuntimeCli( : await runBundledRuntimeCli(
runtimeStatus.json.runtimeRoot, runtimeStatus.json.runtimeRoot,
managedStart.managedHome, managedStart.managedHome,
@@ -650,14 +669,15 @@ try {
logStep("Verifying relay connectivity still works after the desktop command has exited"); logStep("Verifying relay connectivity still works after the desktop command has exited");
const relayPairing = cliShimInstalled const relayPairing = cliShimInstalled
? await execFileAsync( ? await execFileWithTimeout(
cliShimPath, cliShimPath,
["daemon", "pair", "--home", managedStart.managedHome], ["daemon", "pair", "--home", managedStart.managedHome],
{ {
env: managedEnv, env: managedEnv,
cwd: repoRoot, cwd: repoRoot,
maxBuffer: 4 * 1024 * 1024, maxBuffer: 4 * 1024 * 1024,
} },
"installed CLI shim relay pairing"
) )
: await runBundledRuntimeCli( : await runBundledRuntimeCli(
runtimeStatus.json.runtimeRoot, runtimeStatus.json.runtimeRoot,