Skip to content
Draft
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
26 changes: 10 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,28 +124,16 @@ jobs:

- name: Start Supabase
run: |
pnpm run supabase start > supabase_output.txt 2>&1
pnpm run supabase start
echo "Supabase started successfully"
pnpm run supabase migration up
echo "Supabase migrations applied successfully"

- name: Create Environment File
run: |
# Extract anon key and service key from Supabase output
# Handle the exact format with leading spaces for anon key
ANON_KEY=$(grep -E '^\s+anon key:' supabase_output.txt | sed 's/.*anon key: //')
SERVICE_KEY=$(grep -E '^service_role key:' supabase_output.txt | sed 's/.*service_role key: //')

# Fallback: extract JWT tokens directly if the above fails
if [ -z "$ANON_KEY" ] || [ -z "$SERVICE_KEY" ]; then
echo "Primary extraction failed, trying JWT pattern matching..."
# Extract all JWT tokens and assign them based on position
TOKENS=($(grep -oE 'eyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]*\.[A-Za-z0-9_-]*' supabase_output.txt))
if [ ${#TOKENS[@]} -ge 2 ]; then
ANON_KEY=${TOKENS[0]}
SERVICE_KEY=${TOKENS[1]}
fi
fi
# Extract anon key and service key from Supabase status
ANON_KEY=$(pnpm --silent run supabase status | grep -E '^\s+anon key:' | sed 's/.*anon key: //')
SERVICE_KEY=$(pnpm --silent run supabase status | grep -E '^service_role key:' | sed 's/.*service_role key: //')

echo "VITE_SUPABASE_URL=http://localhost:54321" > .env.local
echo "VITE_SUPABASE_ANON_KEY=$ANON_KEY" >> .env.local
Expand All @@ -155,6 +143,12 @@ jobs:
echo "Extracted anon key: ${ANON_KEY:0:10}...${ANON_KEY: -10}"
echo "Extracted service key: ${SERVICE_KEY:0:10}...${SERVICE_KEY: -10}"

# Fail if keys were not extracted
if [ -z "$ANON_KEY" ] || [ -z "$SERVICE_KEY" ]; then
echo "Failed to extract keys from supabase status"
exit 1
fi

- name: Run unit tests
run: TEST_SUPABASE=1 DESTRUCTIVE_SUPABASE=1 pnpm run test

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"@emoji-mart/data": "^1.2.1",
"@emoji-mart/react": "^1.1.1",
"@eslint/js": "^9.30.1",
"@supabase/supabase-js": "^2.50.4",
"@supabase/supabase-js": "^2.99.1",
"@tailwindcss/vite": "^4.2.1",
"@types/node": "^24.0.1",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.1.6",
"@vercel/analytics": "^2.0.1",
Expand All @@ -37,7 +38,7 @@
"react-dom": "^19.1.0",
"react-icons": "^5.6.0",
"react-router": "^7.13.1",
"supabase": "^2.30.4",
"supabase": "^2.78.1",
"tailwindcss": "^4.2.1",
"typescript": "~5.8.3",
"typescript-eslint": "^8.36.0",
Expand Down
Loading
Loading