fix: harden release gate and page delivery
Memind CI / Test, build, and release guards (push) Failing after 12m3s
Memind CI / Test, build, and release guards (push) Failing after 12m3s
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env node
|
||||
import { spawn } from 'node:child_process';
|
||||
import path from 'node:path';
|
||||
|
||||
import { assertPortalRuntimePath, hashArtifact } from '../release-gate/artifact.mjs';
|
||||
|
||||
const root = path.resolve(new URL('..', import.meta.url).pathname);
|
||||
const runtime = assertPortalRuntimePath(path.join(root, '.runtime', 'portal'), { repoRoot: root });
|
||||
|
||||
async function buildRuntime() {
|
||||
const code = await new Promise((resolve, reject) => {
|
||||
const child = spawn('npm', ['run', 'build:portal-runtime'], {
|
||||
cwd: root,
|
||||
env: process.env,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
child.once('error', reject);
|
||||
child.once('close', (status) => resolve(status ?? 1));
|
||||
});
|
||||
if (code !== 0) throw new Error(`runtime rebuild failed with code ${code}`);
|
||||
}
|
||||
|
||||
const candidate = await hashArtifact(runtime);
|
||||
await buildRuntime();
|
||||
const firstRebuild = await hashArtifact(runtime);
|
||||
await buildRuntime();
|
||||
const secondRebuild = await hashArtifact(runtime);
|
||||
|
||||
const hashes = [candidate.sha256, firstRebuild.sha256, secondRebuild.sha256];
|
||||
if (new Set(hashes).size !== 1) {
|
||||
throw new Error(`runtime is not reproducible: ${hashes.join(' != ')}`);
|
||||
}
|
||||
console.log(`PASS REL-03 reproducible runtime sha256=${candidate.sha256}`);
|
||||
Reference in New Issue
Block a user