feat: prepare versioned production Curio releases

This commit is contained in:
2026-09-09 17:28:28 +08:00
parent 775d891288
commit 68b7164df8
10 changed files with 461 additions and 54 deletions
+16 -4
View File
@@ -1,4 +1,5 @@
import { spawn } from 'node:child_process';
import { spawn, spawnSync } from 'node:child_process';
import { parseArgs } from 'node:util';
import { createInterface } from 'node:readline';
import { mkdir, writeFile, access, rm } from 'node:fs/promises';
import path from 'node:path';
@@ -8,10 +9,12 @@ import { assert, equal, expectError, hostChecks, backendChecks, sleep } from '..
import { serve } from './serve.mjs';
// Only this optional integration adapter depends on the app checkout.
await rm(path.join(output, 'verification.json'), { force: true });
const { values: args } = parseArgs({ options: { 'remote-source': { type: 'string' }, 'source-id': { type: 'string', default: 'trove-official' } } });
const reportPath = path.join(output, args['remote-source'] ? 'remote-verification.json' : 'verification.json');
await rm(reportPath, { force: true });
const app = process.env.TROVE_APP_DIR;
if (!app) throw new Error('Set TROVE_APP_DIR to the app repository, then run pnpm run verify.');
await access(path.join(output, 'suite.json')).catch(() => { throw new Error('Run pnpm run pack first.'); });
if (!args['remote-source']) await access(path.join(output, 'suite.json')).catch(() => { throw new Error('Run pnpm run pack first.'); });
const harness = path.join(output, 'host-check');
await mkdir(harness, { recursive: true });
const manifest = `[package]
@@ -37,9 +40,18 @@ await writeFile(path.join(harness, 'Cargo.toml'), manifest);
const target = process.env.TROVE_QA_TARGET_DIR || path.join(output, 'host-target');
try {
run('cargo', ['build', '--manifest-path', path.join(harness, 'Cargo.toml'), '--target-dir', target]);
if (args['remote-source']) {
const result = spawnSync(path.join(target, 'debug/trove-qa-host-check'), ['--remote-source', args['remote-source'], args['source-id']], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'inherit'], timeout: 180000 });
if (result.error) throw result.error;
const report = JSON.parse(result.stdout);
report.generatedAt = new Date().toISOString();
await writeFile(reportPath, JSON.stringify(report, null, 2) + '\n');
console.log(`${report.passed} passed, ${report.failed} failed. Report: ${reportPath}`);
process.exit(result.status ?? 1);
}
run(troveBin, ['protocol', 'test', '--command', path.join(root, 'shared/backend/target/release/trove-qa-backend')]);
} catch (error) {
await writeFile(path.join(output, 'verification.json'), JSON.stringify({
await writeFile(reportPath, JSON.stringify({
schemaVersion: 1, generatedAt: new Date().toISOString(), passed: 0, failed: 1, observed: 0,
results: [{ name: '编译适配器 / CLI 协议检查', status: 'fail', error: { message: error.message } }],
}, null, 2) + '\n');