Skip to content

upgrade nextjs app

upgrade nextjs app #59

Workflow file for this run

name: CI
on:
pull_request:
branches: [ main ]
jobs:
verify:
name: Install → Build → Lint → Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20"
cache: npm
- run: npm ci
- run: npm run lint
- run: npm test
e2e:
name: E2E (Cypress via Docker + Next.js)
needs: verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# 1) install JS deps so `next dev` exists:
- name: Install dependencies
run: npm ci
# 2) generate a full .env before starting anything:
- name: Generate Env File
run: |
cat <<EOF > .env
NEXT_PUBLIC_APP_ENV=TEST
DCUP_PARSER=http://localhost:9000
NEXTAUTH_URL=http://localhost:3000
DROPBOX_CLIENT_ID=xxxxxxx
DROPBOX_CLIENT_SECRET=xxxxx
REDIS_DB_ADDRESS=localhost
REDIS_DB_PORT=6379
REDIS_DB_PASSWORD=
REDIS_DB_DATABASE=0
OPENAI_KEY="my key"
NEXTAUTH_SECRET=tZuoxOlhNxw7Q/r3DCiuVKZJ7op1dX/XTLYqG3rEurA=
DRIZZLE_DATABASE_URL=postgres://postgres:root@localhost:5432/dcup
NODE_ENV=production
OPENAI_ENDPOINT=https://models.inference.ai.azure.com
OPENAI_EMBEDDINGS_MODEL=text-embedding-3-small
OPENAI_AGENT_MODEL=gpt-4o-mini
QDRANT_DB_URL=http://localhost:6333
NEXT_PUBLIC_GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
NEXT_PUBLIC_GOOGLE_API_KEY=
AUTH_GITHUB_ID=
AUTH_GITHUB_SECRET=
API_SECRET=xOAsKzZlYeGqaLiZNv6esJ
API_ACCESS_SECRET=fafkldsajfkldsjfoajFDIOASJFOfdlfja
EOF
# 3) spin up your other services (redis, postgres, etc):
- name: Start services with Make
run: |
make docker-run &
sleep 10 # give containers time to initialize
# 4) start your Next.js app in dev mode
- name: Start Next.js
run: |
npm run dev &
sleep 10 # give Next.js time to boot
# 5) wait for both web & db ports
- name: Wait for HTTP & Postgres
run: |
npx wait-on http://localhost:3000
npx wait-on tcp:5432
npx wait-on tcp:6333
- name: set up DB
run: npm run generate && npm run pushdb
# 6) run Cypress
- name: Run Cypress E2E
env:
CYPRESS_baseUrl: http://localhost:3000
run: npx cypress run
# 7) teardown your Docker services
- name: Stop services
if: always()
run: make docker-down