-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathe2e_services.sh
More file actions
executable file
·40 lines (29 loc) · 1.34 KB
/
e2e_services.sh
File metadata and controls
executable file
·40 lines (29 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# TODO: is the same as run_local_isolated.sh apart from the process cleanup. See if they can be merged.
# Test services and isolated dev services are the same for now, but they may diverge in the future.
set -euo pipefail
# Change to project root
cd "$(dirname "$0")"/..
export NEXT_PUBLIC_ISOLATED_ENV=true
export $(cat .env.local | grep -v '^#' | xargs)
export $(cat .env.test | grep -v '^#' | xargs)
# Ensure Supabase local stack is running; if not, reset/start it
STATUS_JSON=$(supabase status --output json 2>/dev/null || echo '')
API_URL=$(echo "$STATUS_JSON" | jq -r '.API_URL // empty')
if [ -z "$API_URL" ]; then
echo "Supabase is not running. Bootstrapping local stack with: yarn test:db:reset"
yarn test:db:reset
STATUS_JSON=$(supabase status --output json)
fi
export NEXT_PUBLIC_SUPABASE_URL=$(echo "$STATUS_JSON" | jq -r '.API_URL')
export NEXT_PUBLIC_SUPABASE_ANON_KEY=$(echo "$STATUS_JSON" | jq -r '.ANON_KEY')
export DATABASE_URL=$(echo "$STATUS_JSON" | jq -r '.DB_URL')
for var in NEXT_PUBLIC_SUPABASE_URL NEXT_PUBLIC_SUPABASE_ANON_KEY DATABASE_URL; do
if [ -z "${!var}" ] || [ "${!var}" = "null" ]; then
echo "Error: $var is not set or null" >&2
exit 1
fi
done
# Build backend (required?)
./scripts/build_api.sh
concurrently --names 'firebase,api,web' 'yarn emulate' 'yarn --cwd=backend/api dev' 'yarn --cwd=web dev'