repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources15d ago| #1 | /** |
| #2 | * automaton-main/automation/ci.ts — CI/CD pipeline |
| #3 | * |
| #4 | * Runs the full quality gate used in automation: |
| #5 | * 1. build automaton-main runtime and dashboard |
| #6 | * 2. run automaton-main tests |
| #7 | * |
| #8 | * Invoked by: |
| #9 | * npm run automation:ci |
| #10 | * bash automaton-main/automation/leviathan.sh --ci |
| #11 | * npx tsx automaton-main/automation/index.ts --ci |
| #12 | */ |
| #13 | |
| #14 | import { execSync } from 'node:child_process'; |
| #15 | import { join } from 'node:path'; |
| #16 | import chalk from 'chalk'; |
| #17 | |
| #18 | const GREEN = chalk.hex('#14F195'); |
| #19 | const RED = chalk.red; |
| #20 | const REPO_ROOT = join(import.meta.dirname, '..', '..'); |
| #21 | |
| #22 | export interface CiOptions { |
| #23 | quiet?: boolean; |
| #24 | } |
| #25 | |
| #26 | type Step = { label: string; cmd: string }; |
| #27 | |
| #28 | const STEPS: Step[] = [ |
| #29 | { label: 'build', cmd: 'npm run automaton:build' }, |
| #30 | { label: 'test', cmd: 'npm run automaton:test' }, |
| #31 | ]; |
| #32 | |
| #33 | export async function runCi(opts: CiOptions = {}): Promise<void> { |
| #34 | const { quiet = false } = opts; |
| #35 | |
| #36 | if (!quiet) { |
| #37 | console.log(chalk.bold('\n automaton-main/automation/ci.ts — CI pipeline\n')); |
| #38 | } |
| #39 | |
| #40 | const results: Array<{ label: string; ok: boolean; ms: number }> = []; |
| #41 | |
| #42 | for (const s of STEPS) { |
| #43 | const t0 = Date.now(); |
| #44 | let passed = false; |
| #45 | try { |
| #46 | execSync(s.cmd, { |
| #47 | stdio: quiet ? 'pipe' : 'inherit', |
| #48 | encoding: 'utf8', |
| #49 | cwd: REPO_ROOT, |
| #50 | }); |
| #51 | passed = true; |
| #52 | } catch { |
| #53 | // fall through |
| #54 | } |
| #55 | const ms = Date.now() - t0; |
| #56 | results.push({ label: s.label, ok: passed, ms }); |
| #57 | |
| #58 | const icon = passed ? GREEN('✓') : RED('✗'); |
| #59 | console.log(` ${icon} ${s.label.padEnd(12)} ${chalk.dim(`${ms}ms`)}`); |
| #60 | |
| #61 | if (!passed) { |
| #62 | console.error(RED(`\n CI failed at step: ${s.label}\n`)); |
| #63 | process.exit(1); |
| #64 | } |
| #65 | } |
| #66 | |
| #67 | const total = results.reduce((acc, r) => acc + r.ms, 0); |
| #68 | console.log(`\n ${GREEN('✓')} All CI checks passed ${chalk.dim(`(${total}ms)`)}`); |
| #69 | } |
| #70 |