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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
pull_request:
branches: [main, preview]
push:
branches: [preview]
workflow_dispatch: # allows manual trigger from GitHub Actions tab

jobs:
build:
name: Build check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
NEXTAUTH_URL: https://dbirecoding.vercel.app
RUNNER_URL: https://code-runner-cpqt.onrender.com
RUNNER_API_KEY: dummy
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Recoding — Exercise Platform

A controlled environment for running timed coding and writing exercises with live anti-cheat monitoring.
A controlled environment for running timed coding and writing exercises with live anti-cheat monitoring.

---

Expand Down
5 changes: 2 additions & 3 deletions lib/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ if (!process.env.DATABASE_URL) {
}

if (!process.env.DATABASE_URL) {
throw new Error('DATABASE_URL environment variable is not set');
// Don't throw at module load (breaks Next.js build) — throw at query time instead
console.warn('[db] DATABASE_URL is not set — queries will fail at runtime');
}

// Use @neondatabase/serverless in Next.js (works over HTTPS, no port 5432 needed)
Expand All @@ -37,8 +38,6 @@ async function getQueryFn() {
return _queryFn;
} catch { /* fall through to pg */ }
}

// pg fallback — works in scripts and when port 5432 is accessible
const { Pool } = await import('pg');
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
pool.on('error', (err) => console.error('[db] Pool error:', err.message));
Expand Down
Loading