-
Notifications
You must be signed in to change notification settings - Fork 516
160 lines (133 loc) · 5.41 KB
/
e2e-fallback-tests.yaml
File metadata and controls
160 lines (133 loc) · 5.41 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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# TODO: keep in sync with e2e-tests.yaml — this is a near-copy with the backend
# started on the fallback port (8110) only, so the SDK exercises fallback logic.
name: Runs E2E Fallback Tests
on:
push:
branches:
- main
- dev
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}
jobs:
build:
name: E2E Fallback Tests (Node ${{ matrix.node-version }})
runs-on: ubicloud-standard-8
env:
NODE_ENV: test
STACK_ENABLE_HARDCODED_PASSKEY_CHALLENGE_FOR_TESTING: yes
STACK_DATABASE_CONNECTION_STRING: "postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@localhost:8128/stackframe"
STACK_EXTERNAL_DB_SYNC_MAX_DURATION_MS: "20000"
STACK_EXTERNAL_DB_SYNC_DIRECT: "false"
strategy:
matrix:
node-version: [22.x]
steps:
- uses: actions/checkout@v6
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Start Docker Compose in background
uses: JarvusInnovations/background-action@v1.0.7
with:
run: docker compose -f docker/dependencies/docker.compose.yaml up --pull always -d &
wait-on: /dev/null
tail: true
wait-for: 3s
log-output-if: true
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Create .env.test.local files
run: |
cp apps/backend/.env.development apps/backend/.env.test.local
cp apps/dashboard/.env.development apps/dashboard/.env.test.local
cp apps/e2e/.env.development apps/e2e/.env.test.local
cp docs/.env.development docs/.env.test.local
cp examples/cjs-test/.env.development examples/cjs-test/.env.test.local
cp examples/demo/.env.development examples/demo/.env.test.local
cp examples/docs-examples/.env.development examples/docs-examples/.env.test.local
cp examples/e-commerce/.env.development examples/e-commerce/.env.test.local
cp examples/middleware/.env.development examples/middleware/.env.test.local
cp examples/supabase/.env.development examples/supabase/.env.test.local
cp examples/convex/.env.development examples/convex/.env.test.local
- name: Build
run: pnpm build
- name: Wait on Postgres
run: pnpm run wait-until-postgres-is-ready:pg_isready
- name: Wait on Inbucket
run: pnpx wait-on tcp:localhost:8129
- name: Wait on Svix
run: pnpx wait-on tcp:localhost:8113
- name: Wait on QStash
run: pnpx wait-on tcp:localhost:8125
- name: Wait on ClickHouse
run: pnpx wait-on http://localhost:8136/ping
- name: Initialize database
run: pnpm run db:init
# Start backend ONLY on fallback port 8110 — primary port 8102 is intentionally left down
# so the SDK exercises its fallback logic for every request.
- name: Start stack-backend on fallback port (8110)
uses: JarvusInnovations/background-action@v1.0.7
with:
run: pnpm -C apps/backend run with-env:test next start --port 8110 &
wait-on: |
http://localhost:8110
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:8101
tail: true
wait-for: 30s
log-output-if: true
- name: Start mock-oauth-server in background
uses: JarvusInnovations/background-action@v1.0.7
with:
run: pnpm run start:mock-oauth-server --log-order=stream &
wait-on: |
http://localhost:8110
tail: true
wait-for: 30s
log-output-if: true
- name: Start run-email-queue in background
uses: JarvusInnovations/background-action@v1.0.7
with:
run: pnpm -C apps/backend run run-email-queue --log-order=stream &
wait-on: |
http://localhost:8110
tail: true
wait-for: 30s
log-output-if: true
- name: Start run-cron-jobs in background
uses: JarvusInnovations/background-action@v1.0.7
with:
run: pnpm -C apps/backend run run-cron-jobs:test --log-order=stream &
wait-on: |
http://localhost:8110
tail: true
wait-for: 30s
log-output-if: true
- name: Wait 10 seconds
run: sleep 10
- name: Verify primary port 8102 is NOT running
run: |
if curl -s -o /dev/null -w "%{http_code}" http://localhost:8102/health 2>/dev/null | grep -q "200"; then
echo "ERROR: Primary backend on port 8102 should NOT be running for fallback tests"
exit 1
fi
echo "Confirmed: primary port 8102 is down, fallback tests will exercise SDK fallback logic"
- name: Run tests
run: pnpm test run
- name: Verify data integrity
run: pnpm run verify-data-integrity --no-bail
- name: Print Docker Compose logs
if: always()
run: docker compose -f docker/dependencies/docker.compose.yaml logs