-
Notifications
You must be signed in to change notification settings - Fork 334
371 lines (330 loc) · 12.5 KB
/
test.yaml
File metadata and controls
371 lines (330 loc) · 12.5 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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
name: Tests
on:
push:
branches:
- master
- 'release-*'
pull_request:
branches:
- master
- 'release-*'
workflow_dispatch:
inputs:
environment:
description: 'Environment to run tests against'
type: environment
required: true
env:
TEST_USERNAME: admin
TEST_PASSWORD: password
CATTLE_BOOTSTRAP_PASSWORD: password
TEST_BASE_URL: https://127.0.0.1.sslip.io
API: https://127.0.0.1.sslip.io
TEST_PROJECT_ID: rancher-dashboard
TEST_DISABLE_DASHBOARD: ${{ vars.TEST_DISABLE_DASHBOARD }} # This is required to get it from the project configuration
TEST_DISABLE_DASHBOARD_LABEL: "${{ contains(github.event.pull_request.labels.*.name, 'ci/skip-e2e-cypress-dashboard')}}"
CYPRESS_API_URL: http://139.59.134.103:1234/
TEST_RUN_ID: ${{github.run_number}}-${{github.run_attempt}}-${{github.event.pull_request.title || github.event.head_commit.message}}
# Build the dashboard to use in tests. When set to false it will grab `latest` from CDN (useful for running e2e tests quickly)
BUILD_DASHBOARD: true
E2E_RANCHER_LOG: rancher.log
E2E_BUILD_DIST_NAME: dist
E2E_BUILD_DIST_DIR: dist
E2E_BUILD_DIST_EMBER_NAME: dist_ember
E2E_BUILD_DIST_EMBER_DIR: dist_ember
jobs:
e2e-ui-build:
if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- name: Setup env
uses: ./.github/actions/setup
- name: Build e2e
run: yarn e2e:build
- name: Upload e2e build
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ env.E2E_BUILD_DIST_NAME }}
path: ${{ env.E2E_BUILD_DIST_DIR }}/
if-no-files-found: error
retention-days: 10
compression-level: 9
- name: Upload e2e build ember
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ env.E2E_BUILD_DIST_EMBER_NAME }}
path: ${{ env.E2E_BUILD_DIST_EMBER_DIR }}/
if-no-files-found: error
retention-days: 10
compression-level: 9
e2e-test:
if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')"
needs: e2e-ui-build
strategy:
fail-fast: false
matrix:
role: [
{ username: 'admin', tag: '@adminUser' },
{ username: 'standard_user', tag: '@standardUser' }
]
features: [
['@navigation', '@extensions'],
['@charts'],
['@explorer'],
['@explorer2'],
['@virtualizationMgmt', '@fleet'],
['@generic', '@globalSettings'],
['@manager'],
['@userMenu', '@usersAndAuths'],
['@components'],
['@noVai']
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- name: Setup env
uses: ./.github/actions/setup
# Installing fixed version of Chrome since latest version does not work (128 didn't work)
# Leaving this here again in case we need to pin to a specific Chrome version in the future
# - name: Install Chrome
# uses: ./.github/actions/install-chrome
# with:
# chrome-version: '143.0.7499.192-1'
- name: Download e2e build
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.E2E_BUILD_DIST_NAME }}
path: ${{ env.E2E_BUILD_DIST_DIR }}
- name: Download e2e build ember
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.E2E_BUILD_DIST_EMBER_NAME }}
path: ${{ env.E2E_BUILD_DIST_EMBER_DIR }}
- name: Run Rancher
run: yarn e2e:docker
- name: Setup Rancher and user
run: |
yarn e2e:prod
env:
GREP_TAGS: ${{ matrix.role.tag }}Setup+${{ matrix.features[0] }} --@jenkins ${{ matrix.role.tag }}Setup+${{ matrix.features[1] || matrix.features[0] }} --@jenkins
TEST_USERNAME: admin
TEST_ONLY: setup
- name: Run user tests
run: |
yarn e2e:prod
[ "$BUILD_DASHBOARD" != "false" ] || exit 0
env:
TEST_SKIP: setup
GREP_TAGS: ${{ matrix.role.tag }}+${{ matrix.features[0] }} --@jenkins ${{ matrix.role.tag }}+${{ matrix.features[1] || matrix.features[0] }} --@jenkins
TEST_USERNAME: ${{ matrix.role.username }}
VAI_ENABLED: ${{ (matrix.features[0] != '@noVai') && 'true' || 'false' }}
- name: Fetch Rancher Logs
if: ${{ failure() }}
run: yarn docker:local:logs
- name: Create Artifacts Folder
if: ${{ always() }}
run: |
mkdir artifacts
cp -r cypress/screenshots artifacts 2>/dev/null || :
cp -r cypress/videos artifacts 2>/dev/null || :
cp -r cypress/reports/* artifacts || :
cp ${{ env.E2E_RANCHER_LOG }} artifacts/rancher.logs 2>/dev/null || :
cp browser-logs/out.html artifacts/browser-logs.html 2>/dev/null || :
- name: Upload Artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: ${{ always() }}
with:
name: ${{github.run_number}}-${{github.run_attempt}}-artifacts-${{ matrix.role.tag }}${{ matrix.features[0] }}${{ matrix.features[1] }}
path: artifacts/
if-no-files-found: error
retention-days: 5
compression-level: 9
a11y-test:
if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')"
needs: e2e-ui-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- name: Setup env
uses: ./.github/actions/setup
# - name: Install Chrome
# uses: ./.github/actions/install-chrome
# with:
# chrome-version: '143.0.7499.192-1'
- name: Download e2e build
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.E2E_BUILD_DIST_NAME }}
path: ${{ env.E2E_BUILD_DIST_DIR }}
- name: Download e2e build ember
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.E2E_BUILD_DIST_EMBER_NAME }}
path: ${{ env.E2E_BUILD_DIST_EMBER_DIR }}
- name: Run Rancher
run: yarn e2e:docker
- name: Setup Rancher and user
run: |
yarn e2e:prod
env:
GREP_TAGS: "@adminUserSetup+@accessibility --@jenkins"
TEST_USERNAME: admin
TEST_ONLY: setup
- name: Run user tests
run: |
yarn e2e:prod
[ "$BUILD_DASHBOARD" != "false" ] || exit 0
env:
TEST_SKIP: setup
GREP_TAGS: "@adminUser+@accessibility --@jenkins"
TEST_USERNAME: admin
TEST_A11Y: true
TEST_NO_VIDEOS: true
- name: Upload report
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: accessibility-report
path: cypress/accessibility
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- name: Run tests
uses: ./.github/actions/unit-tests
- name: Collect Coverage
run: |
mkdir -p coverage-artifacts/coverage
cp coverage/unit/coverage-final.json coverage-artifacts/coverage/coverage-unit.json
cp -r coverage/unit/ coverage-artifacts/coverage/unit/
- name: Upload coverage
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{github.run_number}}-${{github.run_attempt}}-coverage
path: coverage-artifacts/**/*
- name: Upload unit test junit file
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{github.run_number}}-${{github.run_attempt}}-unit-tests
path: unit-test-reports/*
i18n:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- name: Run i18n lint
uses: ./.github/actions/i18n-lint
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- name: Run tests
uses: ./.github/actions/lint
check-i18n:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version-file: '.nvmrc'
- name: Install packages
run: yarn install:ci
- name: Run i18n string check
run: |
# Falure won't fail the job (remove -x when all current issues are fixed)
./scripts/check-i18n -s -x
check-i18n-links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version-file: '.nvmrc'
- name: Install packages
run: yarn install:ci
- name: Run check of all http links in the i18n files (broken link check)
run: |
./scripts/check-i18n-links
# coverage:
# runs-on: ubuntu-latest
# needs:
# - unit-test
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 1
# - uses: actions/setup-node@v6
# with:
# node-version-file: '.nvmrc'
# - name: Download Coverage Artifacts
# uses: actions/download-artifact@v3
# with:
# name: ${{github.run_number}}-${{github.run_attempt}}-coverage
# - name: Install Codecov CLI
# run : .github/workflows/scripts/install-codecov.sh
# - name: Upload tests coverage report to Codecov
# run: ./codecov --verbose upload-process -t ${{ secrets.CODECOV_TOKEN }} -n ${{github.run_number}}-${{github.run_attempt}}-coverage -F unit -f ./coverage/coverage-unit.json
check-e2e-tags:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version-file: '.nvmrc'
- name: Check e2e tags
run: |
./scripts/check-e2e-tests-for-tags
check-cypress-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version-file: '.nvmrc'
- name: Verify Cypress build
working-directory: ./cypress
run: |
yarn install --frozen-lockfile
yarn build-pkg --verify
# Store the PR number in an artifact for use in TestHub registration since workflow_run triggered by PRs doesn't include the PR number in the head branch or commit message
store-origin:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'push'
steps:
- name: Save PR number or Branch name
env:
PR_NUMBER: ${{ github.event.number }}
run: |
mkdir -p ./origin
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "Storing PR number ${PR_NUMBER} for TestHub registration"
echo "pr/$PR_NUMBER" > ./origin/origin
else
echo "Storing branch name ${GITHUB_REF_NAME} for TestHub registration"
echo "branch/$GITHUB_REF_NAME" > ./origin/origin
fi
cat ./origin/origin
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
name: Upload origin artifact
with:
name: origin
path: origin/