From 02af6685cf407936a1e644026b4fd962de28b07c Mon Sep 17 00:00:00 2001 From: luciano Date: Wed, 29 Apr 2026 14:37:50 +0200 Subject: [PATCH] ci: add GitHub Actions workflow for lint/typecheck/test/build .github/workflows/ci.yml runs on push to main and on PRs. Single job with a Postgres 15 service container, applies migrations via prisma migrate deploy, then lint / format:check / typecheck / unit tests / api+web build. Concurrency group cancels superseded runs on the same ref. Node version is read from .nvmrc and pnpm cache is used to keep installs fast. BETTER_AUTH_SECRET is supplied as a repo secret; falls back to a known test value when the secret is not set so external forks can still run CI. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/.gitkeep | 0 .github/workflows/ci.yml | 76 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) delete mode 100644 .github/workflows/.gitkeep create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/.gitkeep b/.github/workflows/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e8764d7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,76 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + quality: + runs-on: ubuntu-latest + timeout-minutes: 15 + + services: + postgres: + image: postgres:15 + env: + POSTGRES_USER: ketopath + POSTGRES_PASSWORD: ketopath + POSTGRES_DB: ketopath + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready -U ketopath" + --health-interval 5s + --health-timeout 5s + --health-retries 10 + + env: + DATABASE_URL: postgresql://ketopath:ketopath@localhost:5432/ketopath?schema=public + BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET || 'a-test-secret-of-at-least-32-bytes-padding!!' }} + BETTER_AUTH_URL: http://localhost:3000 + NODE_ENV: test + CORS_ORIGINS: http://localhost:3000 + + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Generate Prisma client + run: pnpm db:generate + + - name: Apply migrations + run: pnpm --filter @ketopath/db exec prisma migrate deploy + + - name: Lint + run: pnpm lint + + - name: Format check + run: pnpm format:check + + - name: Typecheck + run: pnpm typecheck + + - name: Unit tests + run: pnpm test + + - name: Build apps + run: | + pnpm --filter @ketopath/api build + pnpm --filter @ketopath/web build