Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 55 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ on:
branches: [main]
pull_request:

env:
NEXT_PUBLIC_APP_URL: http://localhost:3000
AUTH_SECRET: ci-placeholder-auth-secret-value
GOOGLE_CLIENT_ID: ci-google-client-id
GOOGLE_CLIENT_SECRET: ci-google-client-secret
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/guddesk
RESEND_API_KEY: re_ci_placeholder

jobs:
ci:
name: CI
test:
name: Test
runs-on: ubuntu-latest
env:
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/guddesk?sslmode=disable
AUTH_SECRET: ci-auth-secret-not-used
GOOGLE_CLIENT_ID: ci-google-client-id
GOOGLE_CLIENT_SECRET: ci-google-client-secret
RESEND_API_KEY: re_ci_placeholder
NEXT_PUBLIC_APP_URL: http://localhost:3000
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
Expand All @@ -25,16 +26,12 @@ jobs:
with:
node-version-file: ".nvmrc"
cache: pnpm
- name: Validate GudBot AI eval set
run: node qa/ai-eval/score.mjs validate
- name: Install
run: pnpm install --frozen-lockfile
- name: Validate GudBot AI eval set
run: node qa/ai-eval/score.mjs validate
- name: Prisma generate
run: pnpm prisma generate
- name: Typecheck
run: pnpm run build:content && pnpm exec tsc --noEmit
- name: Lint
run: pnpm lint
run: pnpm exec prisma generate
- name: Test
run: |
set -o pipefail
Expand All @@ -45,5 +42,47 @@ jobs:
exit 1
fi
echo "Ran $count tests"
- name: Build content
run: pnpm build:content
- name: Typecheck
run: pnpm exec tsc --noEmit
- name: Lint
run: pnpm lint
- name: Build
run: pnpm build

migrations:
name: Migrations (empty Postgres)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
# A throwaway service container; nothing here reaches a real database.
DATABASE_ADMIN_URL: postgresql://postgres:postgres@localhost:5432/postgres
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Prisma generate
run: pnpm exec prisma generate
- name: prisma migrate deploy on an empty database (no drift, smoke), then upgrade one with data
run: bash scripts/ci-migrate-check.sh
22 changes: 22 additions & 0 deletions prisma/migrations/0006_workspace_app_id/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- Workspace.appId + drop orphan 0001_init workspaces.apiKey.
-- 0002/0003 are reserved for owner-blocked SQL (flowchat #32/#46/#37).
-- Safe on an empty database and on an upgrade that still has apiKey rows.
-- Prisma sets appId defaults (cuid()) in the client, not in the database.

-- AlterTable
ALTER TABLE "workspaces" ADD COLUMN "appId" TEXT;

-- Backfill unique values for existing rows
UPDATE "workspaces"
SET "appId" = 'app_' || "id"
WHERE "appId" IS NULL;

-- AlterTable
ALTER TABLE "workspaces" ALTER COLUMN "appId" SET NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX "workspaces_appId_key" ON "workspaces"("appId");

-- Drop orphan 0001_init column
DROP INDEX IF EXISTS "workspaces_apiKey_key";
ALTER TABLE "workspaces" DROP COLUMN "apiKey";
Loading
Loading