From a3f0a37be05f467b2cc9664fc52b52eb29c9cdd9 Mon Sep 17 00:00:00 2001 From: jvcByte Date: Wed, 15 Apr 2026 02:28:09 +0100 Subject: [PATCH 1/4] Add GitHub Actions CI workflow for build checks on PRs --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..154c1af --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + pull_request: + branches: [main, preview] + push: + branches: [preview] + +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://example.com + RUNNER_URL: https://example.com + RUNNER_API_KEY: dummy From 85bf12969e4cfec978c5a2d82f933443b3cf31a0 Mon Sep 17 00:00:00 2001 From: jvcByte Date: Wed, 15 Apr 2026 02:31:11 +0100 Subject: [PATCH 2/4] Add workflow_dispatch to CI for manual trigger --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 154c1af..119c0ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: branches: [main, preview] push: branches: [preview] + workflow_dispatch: # allows manual trigger from GitHub Actions tab jobs: build: From f346a64b1889c5ec0af8b2c0c296e638c507a137 Mon Sep 17 00:00:00 2001 From: jvcByte Date: Wed, 15 Apr 2026 02:40:29 +0100 Subject: [PATCH 3/4] Add nextauth_url and runner_url --- .github/workflows/ci.yml | 4 ++-- lib/db.ts | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 119c0ca..1e964a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,6 @@ jobs: env: DATABASE_URL: ${{ secrets.DATABASE_URL }} NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} - NEXTAUTH_URL: https://example.com - RUNNER_URL: https://example.com + NEXTAUTH_URL: https://dbirecoding.vercel.app + RUNNER_URL: https://code-runner-cpqt.onrender.com RUNNER_API_KEY: dummy diff --git a/lib/db.ts b/lib/db.ts index 3f42606..3234a9d 100644 --- a/lib/db.ts +++ b/lib/db.ts @@ -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) @@ -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)); From 009469deb23d4e8f602b20efbd0a9c107fcc2b30 Mon Sep 17 00:00:00 2001 From: jvcByte Date: Wed, 15 Apr 2026 02:48:40 +0100 Subject: [PATCH 4/4] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1235e45..688b636 100644 --- a/README.md +++ b/README.md @@ -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. ---