diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5791bf8f1..83db17a9d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -223,6 +223,69 @@ jobs: - run: bun install --frozen-lockfile - run: bun run --filter @hyperframes/core test:hyperframe-runtime-ci + studio-load-smoke: + name: "Studio: load smoke" + needs: [changes] + if: needs.changes.outputs.code == 'true' + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + with: + lfs: true + - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 + with: + node-version: 22 + - run: bun install --frozen-lockfile + - run: bun run --cwd packages/core build:hyperframes-runtime + - name: Start studio and check for runtime errors + run: | + # Start the studio dev server in the background + bun run --filter '@hyperframes/studio' dev -- --port 5199 & + SERVER_PID=$! + + # Wait for the server to be ready (up to 20s) + for i in $(seq 1 40); do + if curl -sf http://localhost:5199/ >/dev/null 2>&1; then break; fi + sleep 0.5 + done + + if ! curl -sf http://localhost:5199/ >/dev/null 2>&1; then + echo "FAIL: studio dev server did not start" + kill $SERVER_PID 2>/dev/null || true + exit 1 + fi + + # Load the studio in headless Chrome and capture console errors + node --input-type=module <<'SMOKE_EOF' + import puppeteer from "puppeteer"; + const browser = await puppeteer.launch({ + headless: "new", + args: ["--no-sandbox", "--disable-setuid-sandbox"], + }); + const page = await browser.newPage(); + const errors = []; + page.on("pageerror", (err) => errors.push(err.message)); + page.on("console", (msg) => { + if (msg.type() === "error") errors.push(msg.text()); + }); + await page.goto("http://localhost:5199/", { waitUntil: "networkidle0", timeout: 30000 }); + await new Promise((r) => setTimeout(r, 3000)); + await browser.close(); + const fatal = errors.filter( + (e) => !e.includes("favicon") && !e.includes("ERR_CONNECTION_REFUSED"), + ); + if (fatal.length > 0) { + console.error("FAIL: studio had runtime errors on load:"); + for (const e of fatal) console.error(" •", e); + process.exit(1); + } + console.log("PASS: studio loaded without runtime errors"); + SMOKE_EOF + + kill $SERVER_PID 2>/dev/null || true + smoke-global-install: name: "Smoke: global install" needs: [changes, build]