-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (132 loc) · 4.09 KB
/
client-cypress-tests.yml
File metadata and controls
154 lines (132 loc) · 4.09 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
name: Client Cypress Tests
# Cancel previous runs for the same PR/branch
concurrency:
group: client-cypress-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ELIZA_NONINTERACTIVE: true
# Skip unnecessary downloads during CI
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
on:
push:
branches:
- 'main'
- 'develop'
paths:
- 'packages/client/**'
- 'packages/core/**'
- 'packages/server/**'
- '.github/workflows/client-cypress-tests.yml'
pull_request:
branches:
- 'main'
- 'develop'
paths:
- 'packages/client/**'
- 'packages/core/**'
- 'packages/server/**'
- '.github/workflows/client-cypress-tests.yml'
jobs:
# Component tests (no server needed)
cypress-component:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PostgreSQL client libraries
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev postgresql-client
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 23
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.4
- name: Install dependencies
run: bun install
- name: Build packages (Turbo cached)
run: bun run build
- name: Install Cypress binary
working-directory: packages/client
run: bunx cypress install
- name: Run Cypress Component Tests
working-directory: packages/client
run: |
# Update dependencies first to ensure compatibility
bun install
# Run component tests
bun run test:component
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI: true
# E2E tests (needs server)
cypress-e2e:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Can add parallelization here: containers: [1, 2, 3]
containers: [1]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PostgreSQL client libraries
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev postgresql-client
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 23
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.4
- name: Install dependencies
run: bun install
- name: Build packages (Turbo cached)
run: bun run build
- name: Install Cypress binary
working-directory: packages/client
run: bunx cypress install
- name: Create .env file
run: |
echo "OPENAI_API_KEY=$OPENAI_API_KEY" > .env
echo "LOG_LEVEL=info" >> .env
- name: Run E2E tests with server
working-directory: packages/client
run: |
chmod +x scripts/test-e2e-server.sh
./scripts/test-e2e-server.sh
env:
SERVER_PORT: 3000
CLIENT_PORT: 5173
# Summary job
cypress-tests-summary:
needs: [cypress-component, cypress-e2e]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check test results
run: |
component_result="${{ needs.cypress-component.result }}"
e2e_result="${{ needs.cypress-e2e.result }}"
if [[ "$component_result" == "failure" || "$e2e_result" == "failure" ]]; then
echo "❌ Cypress tests failed"
echo "Component tests: $component_result"
echo "E2E tests: $e2e_result"
exit 1
elif [[ "$component_result" == "cancelled" || "$e2e_result" == "cancelled" ]]; then
echo "⏹️ Cypress tests were cancelled"
exit 1
else
echo "✅ All Cypress tests passed"
echo "Component tests: $component_result"
echo "E2E tests: $e2e_result"
fi