Skip to content

ci(smoke): scaffold + bring up --next project on every PR#82

Closed
pascal-klesse wants to merge 1 commit intomainfrom
ci/init-smoke-workflow
Closed

ci(smoke): scaffold + bring up --next project on every PR#82
pascal-klesse wants to merge 1 commit intomainfrom
ci/init-smoke-workflow

Conversation

@pascal-klesse
Copy link
Copy Markdown
Member

Summary

The friction log on lt fullstack init --next keeps surfacing the same class of mechanical bug — P1000 auth errors from leftover Postgres state, missing pg_uuidv7 extension, empty datasource.url, hard-coded container_name: clashes across workspaces, prepare:schema not run before prisma:generate. None of these are caught by the existing jest unit tests because they only reproduce when the generated workspace actually boots against Postgres. So they reach humans first.

This PR adds a GitHub Actions workflow (.github/workflows/init-smoke.yml) that runs on every PR and every push to main. It builds the CLI from the PR's source (so the test exercises the actual code under review, not whatever is on npm), npm packs + globally installs the tarball, then scaffolds a real --next workspace into $RUNNER_TEMP and walks it through the documented bring-up.

What the workflow does

  1. Build CLI from sourcenpm install, npm run build (which already runs lint + tests + compile + copy-templates).
  2. Pack + global installnpm pack + npm install -g ./<tarball>. This exercises the same install surface real users get (bin/lt, build/, files[]), not the dev-mode ts-node path.
  3. Scaffold in $RUNNER_TEMP:
    lt fullstack init --name smoke --frontend nuxt --next --noConfirm
    
  4. Bring up the API in the order from the workspace's .claude/QUICKSTART.md (added in fix(fullstack init --next): replace stale root README/CLAUDE.md, suppress noisy noConfirm hint #81):
    bun install
    bun run setup            # writes .env from .env.example
    docker compose up -d --build postgres
    <wait for healthcheck>
    bun run prepare:schema   # materialise feature-gated migrations
    bun run prisma:generate
    bun run prisma:migrate
    bun run build
    
  5. Tear down with docker compose down -v regardless of outcome.

Notes / tradeoffs

  • No boot/health-check yet. The task brief flagged it as optional, and the migrate-and-build step already catches the bulk of bring-up regressions. We can layer in a bun run dev & + /health/ready + /api/openapi.json smoke later once this workflow has shaken out.
  • Postgres image build (~2-3 min). The custom image compiles pg_uuidv7 from source on first build. Pre-build / cache is deliberately deferred — that's an optimisation for after we have signal on stability.
  • Concurrency group — cancels superseded runs on the same ref so a fast follow-up commit doesn't queue a full rebuild.
  • Failure diagnostics — dumps docker compose ps + last 200 lines of postgres logs inline, then uploads the full generated workspace (minus node_modules / .git) as an artifact for 7 days so the bring-up can be reproduced after the runner is recycled.
  • Compose project naming — relies on nest-base having dropped the hard-coded name: / container_name: (commit 25963e0), so the compose project is auto-derived from the workspace dir and parallel runs don't clash.
  • Scope — only .github/workflows/init-smoke.yml. No CLI source changes.

Test plan

  • npm run lint — clean (pre-push hook)
  • npm test — 153 passed (pre-push hook)
  • YAML parses (yq eval '.' .github/workflows/init-smoke.yml)
  • First CI run on this PR — observe the workflow end-to-end, confirm it goes green against current main of lenneTech/nest-base. Any flake or unexpected failure should be triaged before merge.

🤖 Generated with Claude Code

The friction log on `lt fullstack init --next` keeps surfacing the same
class of mechanical bug: P1000 auth errors from leftover Postgres state,
missing `pg_uuidv7` extension, empty `datasource.url`, hard-coded
`container_name:` clashes across workspaces, `prepare:schema` not run
before `prisma:generate`. None of these are caught by the existing unit
tests (jest, in-process) — they only reproduce when the generated
workspace actually boots against Postgres. So they reach humans first.

This adds a GitHub Actions workflow that runs on every PR and every
push to main. It builds the CLI from the PR's source (so the test
exercises the actual code under review, not whatever is on npm),
`npm pack`s + globally installs the resulting tarball, then scaffolds
a real `--next` workspace into `$RUNNER_TEMP` and walks it through
the documented bring-up sequence:

  bun install
  bun run setup            # writes .env from .env.example
  docker compose up -d --build postgres
  <wait for healthcheck>
  bun run prepare:schema   # materialise feature-gated migrations
  bun run prisma:generate
  bun run prisma:migrate
  bun run build

The bring-up matches the order from the workspace's `.claude/QUICKSTART.md`
(added in PR #81). Boot/health-check via `bun run dev` is intentionally
out of scope for now — the migrate-and-build step already catches the
bulk of the bring-up regressions, and adding a live server would just
make the workflow flakier without much added coverage.

Notes / tradeoffs:

- The custom Postgres image (compiles `pg_uuidv7` from source) takes
  ~2-3 min on a cold runner. Pre-build / cache is deliberately deferred;
  optimise once the workflow has shaken out.
- Concurrency group cancels superseded runs on the same ref so a fast
  follow-up commit doesn't queue a full rebuild behind the previous one.
- On failure: dumps `docker compose ps` + last 200 lines of postgres
  logs inline, then uploads the full generated workspace (minus
  `node_modules` / `.git`) as an artifact for 7 days so the bring-up
  can be reproduced after the runner is recycled.
- Teardown runs `docker compose down -v` regardless of outcome so re-
  running the same step locally with `act` starts from a clean slate.

No CLI source changes; only `.github/workflows/init-smoke.yml`.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pascal-klesse
Copy link
Copy Markdown
Member Author

Closing — was based on a misunderstanding of the brief (smoke-test workflow rather than the requested 'rename auto-run' fix). Re-opening as a separate PR scoped to the rename topic.

@pascal-klesse pascal-klesse deleted the ci/init-smoke-workflow branch April 30, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant