ci(workflows): added rust-hash CI flow to skip redundant native builds

This commit is contained in:
can1357
2026-04-30 14:11:48 +02:00
parent 69405b9910
commit bfddf9bf47
5 changed files with 147 additions and 64 deletions
+1 -21
View File
@@ -189,24 +189,10 @@ async function installGeneratedBindings(outputDir: string): Promise<void> {
}
}
function resolveManagedCargoTargetDir(profileLabel: string): string | null {
if (Bun.env.CARGO_TARGET_DIR) {
return null;
}
if (useLocalProfile) {
return null;
}
const buildTarget = crossTarget ?? `${targetPlatform}-${targetArch}`;
const variantLabel = effectiveVariant ?? "default";
return path.join(repoRoot, "target", "napi-build", `${buildTarget}-${variantLabel}-${profileLabel}`);
}
const isCI = Boolean(Bun.env.CI);
const useLocalProfile = !isCI && !isCrossCompile;
const profileLabel = useLocalProfile ? "local" : "ci";
const profileSuffix = useLocalProfile ? " (local)" : " (ci)";
const profileSuffix = ` (${profileLabel})`;
const buildOutputDirPrefix = resolveBuildOutputDirPrefix(profileLabel);
@@ -249,12 +235,6 @@ if (!napiBin) {
throw new Error("Could not locate @napi-rs/cli `napi` binary in node_modules/.bin");
}
const managedCargoTargetDir = resolveManagedCargoTargetDir(profileLabel);
if (managedCargoTargetDir) {
Bun.env.CARGO_TARGET_DIR = managedCargoTargetDir;
console.log(`Using isolated CARGO_TARGET_DIR: ${managedCargoTargetDir}`);
}
const safeHostZigBuildConfig = resolveSafeHostZigBuildConfig();
if (safeHostZigBuildConfig) {
Bun.env.ZIG = safeHostZigBuildConfig.wrapperPath;