forked from rancher/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (160 loc) · 4.91 KB
/
test.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
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
name: Tests
on:
push:
branches:
- master
- 'release-*'
pull_request:
branches:
- master
- 'release-*'
workflow_dispatch:
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:8005
API: https://127.0.0.1
TEST_PROJECT_ID: rancher-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}}
CYPRESS_coverage: true
jobs:
e2e-test:
if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Install packages
run: yarn install:ci
- name: Prepare build
run: yarn e2e:pre-prod
- name: Run admin user tests
run: |
yarn e2e:prod
mkdir -p coverage-artifacts/coverage
cp coverage/e2e/coverage-final.json coverage-artifacts/coverage/coverage-e2e.json
env:
GREP_TAGS: '@adminUser'
TEST_USERNAME: admin
- name: Run standard user tests
if: ${{ success() || failure() }}
run: |
yarn e2e:prod
yarn docker:local:stop
mkdir -p coverage-artifacts/coverage
cp coverage/e2e/coverage-final.json coverage-artifacts/coverage/coverage-e2e.json
env:
GREP_TAGS: '@standardUser'
TEST_USERNAME: standard_user
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: ${{github.run_number}}-${{github.run_attempt}}-coverage
path: coverage-artifacts/**/*
- name: Upload screenshots
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: ${{github.run_number}}-${{github.run_attempt}}-screenshots
path: cypress/screenshots
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Install packages
run: yarn install:ci
- name: Run tests
run: |
yarn test:ci
mkdir -p coverage-artifacts/coverage
cp coverage/unit/coverage-final.json coverage-artifacts/coverage/coverage-unit.json
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: ${{github.run_number}}-${{github.run_attempt}}-coverage
path: coverage-artifacts/**/*
i18n:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Install packages
run: yarn install:ci
- name: Run i18n linters
run: yarn lint-l10n
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Install packages
run: yarn install:ci
- name: Run linters
run: yarn lint
coverage:
if: "!contains( github.event.pull_request.labels.*.name, 'ci/skip-e2e')"
runs-on: ubuntu-latest
needs:
- unit-test
- e2e-test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Download Coverage Artifacts
uses: actions/download-artifact@v2
with:
name: ${{github.run_number}}-${{github.run_attempt}}-coverage
- name: Merge coverage files
run: |
ls
yarn coverage
ls coverage
# Job is flaky now and then, but we do not want to interrupt the development flow
- name: Upload unit test coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit
files: ./coverage/coverage-unit.json
fail_ci_if_error: false
- name: Upload e2e test coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: e2e
files: ./coverage/coverage-e2e.json
fail_ci_if_error: false
- name: Upload merged coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: merged
files: ./coverage/coverage.json
fail_ci_if_error: false