-
Notifications
You must be signed in to change notification settings - Fork 1
Remove obsolete Docker/Buildkite infra, update to Supabase-based local dev #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
6ff0994
f19696f
a3ff7f9
88ab683
c6e43c6
ec8f929
0d593fb
6186222
c82b0da
5461d29
c5142c1
a57ba7e
9006441
7fe04ee
196385a
73bfa24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,27 @@ | ||
| NEXT_PUBLIC_BASE_URL=http://localhost:3000 | ||
| PGHOST= | ||
| PGPORT=5432 | ||
| PGUSER= | ||
| PGHOST=127.0.0.1 | ||
| PGPORT=54322 | ||
| PGUSER=postgres | ||
| PGDATABASE=postgres | ||
| PGPASSWORD= | ||
| PGPASSWORD=postgres | ||
| SENTRY_DSN=sentryDsn | ||
| SENTRY_ENV=sentryEnv | ||
| PUBLIC_S3_BASE_URL=https://test.example.com | ||
| S3_ENDPOINT= | ||
| S3_ENDPOINT=http://127.0.0.1:54321/storage/v1/s3 | ||
| S3_REGION=local | ||
| S3_ACCESS_KEY_ID=accesskeyneedstobeexactly32chars | ||
| S3_ACCESS_KEY_SECRET=12345678 | ||
| S3_MAPS_BUCKET=paradb-maps-test | ||
| MEILISEARCH_HOST=https:// | ||
| MEILISEARCH_KEY=123 | ||
| SEARCH_IMPLEMENTATION=postgres | ||
| MEILISEARCH_HOST=unused | ||
| MEILISEARCH_KEY=unused | ||
| FLAGS_IMPLEMENTATION=local | ||
| FLAGS_EDGE_CONFIG= | ||
| FLAGS_EDGE_CONFIG_KEY= | ||
| NEXT_PUBLIC_SUPABASE_URL= | ||
| FLAGS_EDGE_CONFIG=unused | ||
| FLAGS_EDGE_CONFIG_KEY=unused | ||
| NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 | ||
| NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= | ||
| SUPABASE_SECRET_KEY= | ||
| AXIOM_API_TOKEN= | ||
| AXIOM_DATASET= | ||
| NEXT_PUBLIC_AXIOM_API_TOKEN= | ||
| NEXT_PUBLIC_AXIOM_DATASET= | ||
| AXIOM_API_TOKEN=unused | ||
| AXIOM_DATASET=unused | ||
| NEXT_PUBLIC_AXIOM_API_TOKEN=unused | ||
| NEXT_PUBLIC_AXIOM_DATASET=unused |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install | ||
|
|
||
| - name: Setup Supabase CLI | ||
| uses: supabase/setup-cli@v1 | ||
| with: | ||
| version: latest | ||
|
|
||
| - name: Start Supabase | ||
| run: supabase start | ||
|
|
||
| - name: Set Supabase env vars | ||
| run: | | ||
| supabase status -o env > /tmp/supabase_env | ||
| source /tmp/supabase_env | ||
| echo "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=$ANON_KEY" >> $GITHUB_ENV | ||
| echo "SUPABASE_SECRET_KEY=$SERVICE_ROLE_KEY" >> $GITHUB_ENV | ||
|
|
||
| - name: Load test env vars | ||
| run: | | ||
| # Load .env.test into GITHUB_ENV, skipping comments and blank lines | ||
| while IFS= read -r line; do | ||
| # Skip comments and empty lines | ||
| [[ -z "$line" || "$line" =~ ^# ]] && continue | ||
| key="${line%%=*}" | ||
| value="${line#*=}" | ||
| # Only set if not already defined (Supabase keys from previous step take precedence) | ||
| if [[ -z "${!key}" ]]; then | ||
| echo "$key=$value" >> $GITHUB_ENV | ||
| fi | ||
| done < .env.test | ||
|
|
||
| - name: Typecheck and lint | ||
| run: bun check | ||
|
|
||
| - name: Start dev server | ||
| run: | | ||
| bun next dev & | ||
| # Wait for the server to be ready | ||
| for i in $(seq 1 30); do | ||
| if curl -s http://localhost:3000 > /dev/null 2>&1; then | ||
| echo "Server is ready" | ||
| break | ||
| fi | ||
| echo "Waiting for server to start... ($i/30)" | ||
| sleep 2 | ||
| done | ||
|
|
||
| - name: Run tests | ||
| run: bun test | ||
|
|
||
| - name: Stop Supabase | ||
| if: always() | ||
| run: supabase stop | ||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { execSync } from 'child_process'; | ||
| import { loadEnvConfig } from '@next/env'; | ||
|
|
||
| const projectDir = process.cwd(); | ||
| loadEnvConfig(projectDir); | ||
|
|
||
| /** | ||
| * Resets the local Supabase database before the test suite runs. | ||
| * Uses `supabase db reset` which applies migrations, schemas, and seeds. | ||
| */ | ||
| export default async function globalSetup() { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot this function isn't actually deleting anything, and is still looking at the 'public' schema instead of a separate test one
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 7fe04ee. Tests now use a separate
Dev data in the |
||
| console.log('Resetting Supabase database for tests...'); | ||
| execSync('bun supabase db reset --yes', { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will reset non-test local state, which we don't want
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in a57ba7e. Replaced |
||
| cwd: projectDir, | ||
| stdio: 'inherit', | ||
| }); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of loading from .env.test into GITHUB_ENV, write the Supabase tokens into .env.test locally and then use dotenv -e .env.test when executing bun next dev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in a57ba7e. CI now writes the Supabase tokens directly into
.env.testviased, then uses./node_modules/.bin/dotenv -e .env.test -- bun next devfor the dev server. Removed theGITHUB_ENVloading step entirely.