-
Notifications
You must be signed in to change notification settings - Fork 388
241 lines (206 loc) · 6.42 KB
/
Copy pathtest.yaml
File metadata and controls
241 lines (206 loc) · 6.42 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
name: test
on:
push:
branches:
- main
- release/*
- develop/*
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 22
- name: Setup pnpm
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: 0
run: |
corepack enable
corepack install
pnpm --version
- name: Get pnpm store path
id: pnpm-store
shell: bash
run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
- name: Cache pnpm store
uses: actions/cache@v6
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('package.json', 'pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Cache ESLint cache
uses: actions/cache@v6
with:
path: .eslintcache
key: eslint-${{ hashFiles('pnpm-lock.yaml', '.eslintrc*') }}
restore-keys: |
eslint-
- name: Lint
run: pnpm lint:ci
test-shards:
runs-on: ubuntu-latest
name: Run test shard (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2]
shardTotal: [2]
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 22
- name: Setup pnpm
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: 0
run: |
corepack enable
corepack install
pnpm --version
- name: Get pnpm store path
id: pnpm-store
shell: bash
run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
- name: Cache pnpm store
uses: actions/cache@v6
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('package.json', 'pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Run test shard
run: >
pnpm exec vitest run
--coverage
--silent=passed-only
--reporter=blob
--shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- name: Upload blob report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v6
with:
name: vitest-report-${{ matrix.shardIndex }}
path: .vitest-reports/*
include-hidden-files: true
retention-days: 1
tests:
runs-on: ubuntu-latest
name: Run tests
needs: [lint, test-shards]
if: ${{ !cancelled() }}
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 22
- name: Setup pnpm
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: 0
run: |
corepack enable
corepack install
pnpm --version
- name: Get pnpm store path
id: pnpm-store
shell: bash
run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
- name: Cache pnpm store
uses: actions/cache@v6
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('package.json', 'pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Download blob reports
uses: actions/download-artifact@v6
with:
pattern: vitest-report-*
path: .vitest-reports
merge-multiple: true
- name: Merge test and coverage reports
run: >
pnpm exec vitest
--merge-reports
--coverage
--silent=passed-only
--reporter=default
--reporter.default.summary=false
- name: Verify prerequisite jobs
if: ${{ always() && (needs.lint.result != 'success' || needs.test-shards.result != 'success') }}
run: exit 1
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
e2e:
runs-on: ubuntu-latest
name: Run E2E tests (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 22
- name: Setup pnpm
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: 0
run: |
corepack enable
corepack install
pnpm --version
- name: Get pnpm store path
id: pnpm-store
shell: bash
run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
- name: Cache pnpm store
uses: actions/cache@v6
with:
path: ${{ steps.pnpm-store.outputs.path }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('package.json', 'pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-
- name: Show runner CPU count
run: nproc
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@v6
with:
path: ~/.cache/ms-playwright
key: playwright-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
playwright-
- name: Install Playwright Chromium
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: pnpm test:e2e:install
- name: Build extension
run: pnpm build
- name: Run E2E tests
run: pnpm exec playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@v6
with:
name: e2e-test-results-${{ matrix.shardIndex }}
path: |
test-results/
playwright-report/
retention-days: 14