-
-
Notifications
You must be signed in to change notification settings - Fork 420
265 lines (226 loc) · 8.43 KB
/
Copy pathautomation-tests.yml
File metadata and controls
265 lines (226 loc) · 8.43 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
name: Automation Tests
on:
push:
branches: [ develop, feature/** ]
pull_request:
branches: [ develop ]
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
# Required secrets (each Cypress Cloud project has its own ID and record key):
# CYPRESS_PROJECT_ID_MYSQL - Cypress Cloud project ID for MySQL runs
# CYPRESS_RECORD_KEY_MYSQL - Cypress Cloud record key for MySQL runs
# CYPRESS_PROJECT_ID_POSTGRES - Cypress Cloud project ID for PostgreSQL runs
# CYPRESS_RECORD_KEY_POSTGRES - Cypress Cloud record key for PostgreSQL runs
# CYPRESS_PROJECT_ID_SQLITE - Cypress Cloud project ID for SQLite runs
# CYPRESS_RECORD_KEY_SQLITE - Cypress Cloud record key for SQLite runs
jobs:
# ──────────────────────────────────────────────────────────────
# MySQL (full suite) and PostgreSQL (smoke) — need Docker services
# ──────────────────────────────────────────────────────────────
db-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- db: mysql
db_type: MySQL
connection_string: "Server=127.0.0.1;Port=3306;Database=ombi;User=ombi;Password=ombi;"
cypress_project_id_secret: CYPRESS_PROJECT_ID_MYSQL
cypress_record_key_secret: CYPRESS_RECORD_KEY_MYSQL
cypress_spec: ""
test_scope: full
- db: postgres
db_type: Postgres
connection_string: "Host=127.0.0.1;Port=5432;Database=ombi;Username=ombi;Password=ombi;"
cypress_project_id_secret: CYPRESS_PROJECT_ID_POSTGRES
cypress_record_key_secret: CYPRESS_RECORD_KEY_POSTGRES
cypress_spec: "cypress/features/01-wizard/wizard.feature,cypress/features/login/login.feature,cypress/tests/login/login.spec.ts"
test_scope: smoke
services:
mysql:
image: mysql:8
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ombi
MYSQL_USER: ombi
MYSQL_PASSWORD: ombi
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1"
--health-interval=10s
--health-timeout=5s
--health-retries=5
postgres:
image: postgres:15
ports:
- 5432:5432
env:
POSTGRES_DB: ombi
POSTGRES_USER: ombi
POSTGRES_PASSWORD: ombi
options: >-
--health-cmd="pg_isready -U ombi"
--health-interval=10s
--health-timeout=5s
--health-retries=5
name: "E2E Tests (${{ matrix.db }} - ${{ matrix.test_scope }})"
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: actions/cache@v4
with:
path: |
'**/node_modules'
'/home/runner/.cache/Cypress'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Frontend Deps
run: yarn --cwd ./src/Ombi/ClientApp install
- name: Install Test Dependencies
run: yarn --cwd ./tests install
- name: Start Frontend
run: |
nohup yarn --cwd ./src/Ombi/ClientApp start &
- name: Restore .NET Dependencies
run: dotnet restore ./src/Ombi/Ombi.csproj
- name: Build .NET Project
run: dotnet build ./src/Ombi/Ombi.csproj --no-restore
- name: Write database.json
run: |
cat > ./src/Ombi/database.json <<EOF
{
"OmbiDatabase": {
"Type": "${{ matrix.db_type }}",
"ConnectionString": "${{ matrix.connection_string }}"
},
"SettingsDatabase": {
"Type": "${{ matrix.db_type }}",
"ConnectionString": "${{ matrix.connection_string }}"
},
"ExternalDatabase": {
"Type": "${{ matrix.db_type }}",
"ConnectionString": "${{ matrix.connection_string }}"
}
}
EOF
- name: Start Backend
run: |
nohup dotnet run --project ./src/Ombi -- --host http://*:3577 &
- name: Run Wiremock
run: nohup docker run --rm -p 32400:8080 --name wiremock wiremock/wiremock:2.35.0 &
- name: Sleep for server to start
run: sleep 20
- name: Cypress Tests (full suite)
if: matrix.cypress_spec == ''
uses: cypress-io/github-action@v4
with:
record: true
browser: chrome
headless: true
working-directory: tests
wait-on: http://localhost:3577/
wait-on-timeout: 600
env:
CYPRESS_RECORD_KEY: ${{ secrets[matrix.cypress_record_key_secret] }}
CYPRESS_PROJECT_ID: ${{ secrets[matrix.cypress_project_id_secret] }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cypress Tests (smoke)
if: matrix.cypress_spec != ''
uses: cypress-io/github-action@v4
with:
record: true
browser: chrome
headless: true
working-directory: tests
spec: ${{ matrix.cypress_spec }}
wait-on: http://localhost:3577/
wait-on-timeout: 600
env:
CYPRESS_RECORD_KEY: ${{ secrets[matrix.cypress_record_key_secret] }}
CYPRESS_PROJECT_ID: ${{ secrets[matrix.cypress_project_id_secret] }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Stop Services
if: always()
run: |
pkill -f "dotnet.*Ombi" || true
docker container kill wiremock || true
# ──────────────────────────────────────────────────────────────
# SQLite (smoke) — no Docker services needed
# ──────────────────────────────────────────────────────────────
sqlite-tests:
runs-on: ubuntu-latest
name: "E2E Tests (sqlite - smoke)"
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: actions/cache@v4
with:
path: |
'**/node_modules'
'/home/runner/.cache/Cypress'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Frontend Deps
run: yarn --cwd ./src/Ombi/ClientApp install
- name: Install Test Dependencies
run: yarn --cwd ./tests install
- name: Start Frontend
run: |
nohup yarn --cwd ./src/Ombi/ClientApp start &
- name: Restore .NET Dependencies
run: dotnet restore ./src/Ombi/Ombi.csproj
- name: Build .NET Project
run: dotnet build ./src/Ombi/Ombi.csproj --no-restore
- name: Start Backend
run: |
nohup dotnet run --project ./src/Ombi -- --host http://*:3577 &
- name: Run Wiremock
run: nohup docker run --rm -p 32400:8080 --name wiremock wiremock/wiremock:2.35.0 &
- name: Sleep for server to start
run: sleep 20
- name: Cypress Tests (smoke)
uses: cypress-io/github-action@v4
with:
record: true
browser: chrome
headless: true
working-directory: tests
spec: "cypress/features/01-wizard/wizard.feature,cypress/features/login/login.feature,cypress/tests/login/login.spec.ts"
wait-on: http://localhost:3577/
wait-on-timeout: 600
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cypress Tests - All other tests
uses: cypress-io/github-action@v4
with:
record: true
browser: chrome
headless: true
working-directory: tests
wait-on: http://localhost:3577/
wait-on-timeout: 600
spec: >-
cypress/tests/**/*
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY_SQLITE }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID_SQLITE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Stop Services
if: always()
run: |
pkill -f "dotnet.*Ombi" || true
docker container kill wiremock || true