-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (81 loc) · 2.87 KB
/
tests-e2e.yml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Cypress Tests
on:
push:
branches:
- "main"
paths:
- "**.js"
- "**.ts"
- "**.jsx"
- "**.tsx"
- "**/prisma/data/**.json"
- "cypress/**"
pull_request:
types: [opened, reopened, synchronize]
paths:
- "**.js"
- "**.ts"
- "**.jsx"
- "**.tsx"
- "**/prisma/data/**.json"
- "cypress/**"
jobs:
cypress-run:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "latest"
- run: bun install
- name: Setup Env
run: |
cp .env.example .env
sed -i "s|NEXT_PUBLIC_SUPABASE_URL=.*|NEXT_PUBLIC_SUPABASE_URL=${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}|" .env
sed -i "s|NEXT_PUBLIC_SUPABASE_ANON_KEY=.*|NEXT_PUBLIC_SUPABASE_ANON_KEY=${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}|" .env
sed -i "s|EDGE_CONFIG=.*|EDGE_CONFIG=${{ secrets.EDGE_CONFIG }}|" .env
- name: Start Docker Compose
run: docker compose up -d --quiet-pull
- name: Wait for database to be ready
run: |
echo "Waiting for database to be ready..."
until docker exec $(docker ps -qf "name=supabase-db") pg_isready -U postgres; do
sleep 1
done
echo "Database is ready"
- name: Load database
run: bun run db:reset -f
# required for cypress to generate a hashkey for caching
# cypress github action naively terminates if lockfile
# for either of yarn/npm/pnpm is missing
- run: touch yarn.lock
- name: Run Cypress tests
uses: cypress-io/github-action@v6
with:
install-command: bun install
build: bun run build
start: bun run start
browser: chrome
env:
CYPRESS_TEST_EMAIL_V1_VALID: ${{ secrets.CYPRESS_TEST_EMAIL_V1_VALID }}
CYPRESS_TEST_EMAIL_V2_VALID: ${{ secrets.CYPRESS_TEST_EMAIL_V2_VALID }}
CYPRESS_TEST_PWD_VALID: ${{ secrets.CYPRESS_TEST_PWD_VALID }}
CYPRESS_TEST_REVIEW_SUBMISSION: false
# required for authjs to trust localhost
# See https://authjs.dev/getting-started/deployment#auth_trust_host
AUTH_TRUST_HOST: true
# after the test run completes store videos and any screenshots
- uses: actions/upload-artifact@v4
# add the line below to store screenshots only on failures
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
- uses: actions/upload-artifact@v4
with:
name: cypress-videos
path: cypress/videos
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`