-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (49 loc) · 1.47 KB
/
Copy pathtest.yml
File metadata and controls
61 lines (49 loc) · 1.47 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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: Write Supabase tokens into .env.test
run: |
supabase status -o env > /tmp/supabase_env
source /tmp/supabase_env
sed -i "s|^NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=.*|NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=$ANON_KEY|" .env.test
sed -i "s|^SUPABASE_SECRET_KEY=.*|SUPABASE_SECRET_KEY=$SERVICE_ROLE_KEY|" .env.test
- name: Typecheck and lint
run: bun check
- name: Start dev server
run: |
./node_modules/.bin/dotenv -e .env.test -- 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