hellth-hub/.forgejo/workflows/ci.yml
Sebastian Mayer 0031268416
Some checks are pending
CI / Lint, Typecheck, Test, Build (push) Waiting to run
Refactor: CI, Schema-Split, 2FA-Optimierung und Code-Hygiene
CI-Pipeline (Forgejo Actions):
- .forgejo/workflows/ci.yml: lint + typecheck + test + admin build
- typecheck-Scripts in packages/api, packages/db, apps/admin ergaenzt
- ESLint FlatConfig (eslint-config-next 16) in apps/admin angelegt
- React-19-Hook-Findings im bestehenden Code als Warnings markiert
  (set-state-in-effect, preserve-manual-memoization, no-unused-vars)

DB-Schema-Split:
- packages/db/src/schema/health.ts (636 Zeilen, Monolith) entfernt und auf
  7 Domain-Module aufgeteilt: profiles, foods, stores, recipes, tracking,
  shopping, community. index.ts re-exportiert alles.

API-Refactoring:
- 2FA-Middleware: 2 DB-Queries pro Admin-Call sind jetzt lazy + per-Request
  gecached. Bei tRPC-Batch-Requests mit mehreren protected Procedures wird
  der 2FA-State nur einmal geladen (siehe context.ts getTwoFactorState).
- any-Typen in trpc/init.ts und trpc/routers/health.ts entfernt; Drizzle
  inferiert Closure-Typen automatisch.
- packages/api/src/trpc/routers/health/_shared.ts: alle Helper-Funktionen
  und Zod-Input-Schemas aus health.ts extrahiert. health.ts: 2419 -> 2061
  Zeilen. Vorbereitung fuer Procedure-Split in Folge-Session.

Konfiguration:
- .env.example um alle in turbo.json deklarierten Env-Vars erweitert,
  jeweils mit Kontext-Kommentar.
- turbo.json um real genutzte Env-Vars erweitert: NEXT_PUBLIC_HELP_URL,
  ENABLE_DB_MIGRATIONS, ADMIN_INITIAL_PASSWORD, DEMO_RECIPE_OWNER_EMAIL.
- .gitignore: *.tsbuildinfo (TypeScript-Build-Cache).
- apps/admin/lib/hellth-data.test.ts: fehlendes Recipe.minutes Feld in Mocks.

Offene Folge-Sessions:
- Vollstaendiger Procedure-Split von routers/health.ts in Sub-Files
- Aufteilung von apps/admin/lib/hellth-data.ts (1149 Zeilen) in Domain-Module

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 23:34:39 +02:00

68 lines
1.9 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
verify:
name: Lint, Typecheck, Test, Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.1
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Tests laden .env via node --env-file (siehe packages/api/package.json).
# Im CI ist sie nicht vorhanden, also legen wir eine minimale CI-Variante an.
# Werte sind Dummies: Tests mocken DB und Auth, die Module-Init-Checks brauchen
# nur, dass die Variablen ueberhaupt gesetzt sind.
- name: Prepare CI .env
run: |
cat > .env <<'EOF'
DATABASE_URL=postgresql://ci:ci@localhost:5432/ci
BETTER_AUTH_SECRET=ci-test-secret-not-used-for-real-please-replace-32
BETTER_AUTH_BASE_URL=http://localhost:3002
PASSKEY_RP_ID=localhost
PASSKEY_RP_NAME=Hellth Hub CI
API_PORT=3002
TRUSTED_ORIGINS=http://localhost:3001
NEXT_PUBLIC_API_URL=http://localhost:3002
PLATFORM_ADMIN_EMAILS=ci@example.org
NEXT_PUBLIC_PLATFORM_ADMIN_EMAILS=ci@example.org
ADMIN_EMAIL=ci@example.org
ADMIN_INITIAL_PASSWORD=ci-test-password-not-used-32-chars
ENABLE_DB_MIGRATIONS=false
ALLOW_SEED_SIGNUP=false
HEALTH_AUDIT_LOGS=false
EOF
- name: Lint
run: pnpm lint
- name: Typecheck
run: pnpm typecheck
- name: Test
run: pnpm test
- name: Build admin
env:
NEXT_PUBLIC_API_URL: http://localhost:3002
run: pnpm --filter admin build