Skip to content

ci: add test-coverage gate, manual docker build test, and build-and-p…#8

Merged
tian-im merged 7 commits into
mainfrom
update-ci
Jun 22, 2026
Merged

ci: add test-coverage gate, manual docker build test, and build-and-p…#8
tian-im merged 7 commits into
mainfrom
update-ci

Conversation

@tian-im

@tian-im tian-im commented Jun 22, 2026

Copy link
Copy Markdown
Owner

…ush workflows

Add three GitHub Actions workflows:

  • test-coverage.yml: runs on every push/PR to main. Builds the dev container, generates Prisma client, and runs unit + integration tests with 100% coverage thresholds enforced by vitest config.

  • docker-build-test.yml: manual workflow (workflow_dispatch) that builds the production Docker image and runs a smoke test without publishing.

  • build-and-push.yml: automatic workflow triggered after test-coverage passes on main. Builds multi-arch (linux/amd64, linux/arm64) image and pushes to ghcr.io with latest, version, and sha- tags.

Removes the old build-push.yml which had no CI dependency.

tian-im added 6 commits June 22, 2026 16:00
…ush workflows

Add three GitHub Actions workflows:

- test-coverage.yml: runs on every push/PR to main. Builds the dev
  container, generates Prisma client, and runs unit + integration tests
  with 100% coverage thresholds enforced by vitest config.

- docker-build-test.yml: manual workflow (workflow_dispatch) that builds
  the production Docker image and runs a smoke test without publishing.

- build-and-push.yml: automatic workflow triggered after test-coverage
  passes on main. Builds multi-arch (linux/amd64, linux/arm64) image
  and pushes to ghcr.io with latest, version, and sha-<commit> tags.

Removes the old build-push.yml which had no CI dependency.
…single container session

Each  creates an ephemeral container. Running
prisma generate in one container and tests in another meant the
generated Prisma client was invisible to subsequent test steps,
causing '@prisma/client did not initialize yet' errors.

Consolidate into a single  with chained commands:
  yarn prisma generate && yarn test:all

This ensures the Prisma client is generated and immediately
available for both unit and integration test suites.
… tests

Integration tests hit a real SQLite database (test.db via test-db.ts),
but the schema tables (Session, Account, Transaction, etc.) were never
created because prisma migrate deploy was not being run in CI.

Add DATABASE_URL=file:./test.db yarn prisma migrate deploy before
yarn test:all so the integration test database has the full schema.

Unit tests are unaffected — they mock @/lib/db and don't touch a real DB.
…o main

workflow_dispatch only works from the default branch, making the manual
Docker build test invisible until merged. Add pull_request and push
triggers so the Docker build is validated BEFORE merging, not after.

Now when you open a PR:
- test-coverage.yml → runs unit + integration tests (100% coverage)
- docker-build-test.yml → builds + smoke tests the production image
- Both must pass before merging
Next.js App Router route files (app/api/**/route.ts) may only export
HTTP method handlers (GET, POST, etc.). The previously exported
 and  caused a build error:
  'resetBootstrapCache' is not a valid Route export field.

Move bootstrap token caching (getBootstrapHash, resetBootstrapCache)
to src/lib/mcp-bootstrap.ts and import it in route.ts. Add a unit
test (mcp-bootstrap.test.ts) covering all cache paths to maintain
100% coverage across src/lib/.
Two issues caused the production container to be unhealthy:

1. Missing Prisma CLI binary — the Dockerfile runner stage copied
   node_modules/prisma and @prisma but not node_modules/.bin/prisma,
   so npx could not find the prisma command, causing the entrypoint
   to fail on 'prisma generate' and 'prisma migrate deploy'.

2. EACCES on Prisma generated client — after fixing the binary, the
   'prisma generate' safety net in the entrypoint tried to overwrite
   root-owned generated client files, but the container runs as UID
   1001 (nextjs). Added chown for all Prisma-related node_modules
   directories before USER nextjs.

Also fixed PRAGMA log noise in db.ts: use  instead
of  since SQLite PRAGMA statements return results,
which  logs as errors.
Fixes the Node.js 20 deprecation warning by upgrading all actions
to versions that use the Node.js 24 runtime:

  actions/checkout          v4 -> v5  (node20 -> node24)
  docker/setup-buildx-action v3 -> v4  (node20 -> node24)
  docker/setup-qemu-action   v3 -> v4  (node20 -> node24)
  docker/login-action        v3 -> v4  (node20 -> node24)
  docker/build-push-action   v6 -> v7  (node20 -> node24)

All three workflow files are updated:
  - test-coverage.yml
  - docker-build-test.yml
  - build-and-push.yml
@tian-im tian-im merged commit 5b7fbfd into main Jun 22, 2026
2 checks passed
@tian-im tian-im deleted the update-ci branch June 22, 2026 08:35
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