-
Notifications
You must be signed in to change notification settings - Fork 277
132 lines (103 loc) · 4.07 KB
/
e2e-api-tests.yaml
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Runs E2E API Tests
on:
push:
branches:
- dev
- main
pull_request:
branches:
- dev
- main
jobs:
build:
runs-on: ubuntu-latest
env:
NODE_ENV: test
STACK_ENABLE_HARDCODED_PASSKEY_CHALLENGE_FOR_TESTING: yes
strategy:
matrix:
node-version: [20.x, 22.x]
steps:
- uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9.1.2
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Create .env.test.local file for apps/backend
run: cp apps/backend/.env.development apps/backend/.env.test.local
- name: Create .env.test.local file for apps/dashboard
run: cp apps/dashboard/.env.development apps/dashboard/.env.test.local
- name: Create .env.test.local file for apps/e2e
run: cp apps/e2e/.env.development apps/e2e/.env.test.local
- name: Create .env.test.local file for examples/cjs-test
run: cp examples/cjs-test/.env.development examples/cjs-test/.env.test.local
- name: Create .env.test.local file for examples/demo
run: cp examples/demo/.env.development examples/demo/.env.test.local
- name: Create .env.test.local file for examples/docs-examples
run: cp examples/docs-examples/.env.development examples/docs-examples/.env.test.local
- name: Create .env.test.local file for examples/e-commerce
run: cp examples/e-commerce/.env.development examples/e-commerce/.env.test.local
- name: Create .env.test.local file for examples/middleware
run: cp examples/middleware/.env.development examples/middleware/.env.test.local
- name: Create .env.test.local file for examples/partial-prerendering
run: cp examples/partial-prerendering/.env.development examples/partial-prerendering/.env.test.local
- name: Create .env.test.local file for examples/supabase
run: cp examples/supabase/.env.development examples/supabase/.env.test.local
- name: Build
run: pnpm build
env:
QUETZAL_API_KEY: ${{ secrets.QUETZAL_API_KEY }}
- name: Start Docker Compose
run: docker compose -f dependencies.compose.yaml up -d
- name: Wait on Postgres
run: npx wait-on tcp:localhost:5432
- name: Wait on Inbucket
run: npx wait-on tcp:localhost:2500
- name: Wait on Svix
run: npx wait-on tcp:localhost:8113
- name: Initialize database
run: pnpm run prisma -- migrate reset --force
- name: Start stack-backend in background
uses: JarvusInnovations/background-action@v1.0.7
with:
run: pnpm run start:backend --log-order=stream &
wait-on: |
http://localhost:8102
tail: true
wait-for: 30s
log-output-if: true
- name: Start stack-dashboard in background
uses: JarvusInnovations/background-action@v1.0.7
with:
run: pnpm run start:dashboard --log-order=stream &
wait-on: |
http://localhost:8102
tail: true
wait-for: 30s
log-output-if: true
- name: Start oauth-mock-server in background
uses: JarvusInnovations/background-action@v1.0.7
with:
run: pnpm run start:oauth-mock-server --log-order=stream &
wait-on: |
http://localhost:8102
tail: true
wait-for: 30s
log-output-if: true
- name: Run tests
run: pnpm test
- name: Run tests again, to make sure they are stable (attempt 1)
run: pnpm test
- name: Run tests again, to make sure they are stable (attempt 2)
run: pnpm test
- name: Run tests again, to make sure they are stable (attempt 3)
run: pnpm test
- name: Print Docker Compose logs
if: always()
run: docker compose -f dependencies.compose.yaml logs