Files
SnowLuma/tools/ci-check.mjs
T
TanTan fa9c73363d
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
SnowLuma v2.4.2 source snapshot
2026-11-13 09:02:00 +08:00

52 lines
1.7 KiB
JavaScript

#!/usr/bin/env node
// Local replica of `.github/workflows/ci.yml`.
// Every command and step title below must stay identical to that workflow.
// CI jobs run these in parallel after a frozen install; this script runs the
// same commands once each, in that job's internal order, and still executes
// later steps if an earlier one fails — same as four GitHub jobs reporting
// independently.
import { spawnSync } from 'node:child_process';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const checks = [
['Install dependencies', 'pnpm install --frozen-lockfile'],
['Run all package tests', 'pnpm test'],
['Verify generated action catalog is up to date', 'node tools/check-action-catalog.mjs'],
['Type check all packages', 'pnpm typecheck'],
['Build release inputs', 'pnpm run build:all'],
['Lint managed source files', 'pnpm lint'],
];
const failed = [];
for (const [title, command] of checks) {
console.log(`\n▸ ${title}\n$ ${command}\n`);
const result = spawnSync(command, {
cwd: repoRoot,
shell: true,
stdio: 'inherit',
env: process.env,
});
const code = result.status === 0 ? 0 : (result.status ?? 1);
if (code !== 0) {
failed.push({ title, command, code });
console.error(`\n✗ ${title} failed (exit ${code})`);
} else {
console.log(`\n✓ ${title}`);
}
}
if (failed.length > 0) {
console.error('\nCI suite failed:');
for (const item of failed) {
console.error(` - ${item.title}: \`${item.command}\` (exit ${item.code})`);
}
process.exit(1);
}
console.log('\nCI suite passed (same commands as .github/workflows/ci.yml).');