forked from nasa/openmct
-
Notifications
You must be signed in to change notification settings - Fork 0
360 lines (357 loc) · 12.3 KB
/
Copy pathpr.yml
File metadata and controls
360 lines (357 loc) · 12.3 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
name: PR
on:
push:
pull_request:
types:
- opened
- labeled
env:
NODE_ENV: development
NODE_VERSION: 22
PERCY_POSTINSTALL_BROWSER: "true"
PERCY_LOGLEVEL: "debug"
PERCY_PARALLEL_TOTAL: 2
PERCY_TOKEN: "${{ secrets.PERCY_TOKEN }}"
jobs:
generate_cache_key:
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.57.0-jammy
steps:
- uses: actions/checkout@v4
- id: generate_cache_key
run: |
lock_hash="$(sha256sum package-lock.json | awk '{print $1}')"
echo "cache_key=node${NODE_VERSION}-deps-${lock_hash}" >> "$GITHUB_OUTPUT"
outputs:
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
build_and_cache_dependencies_if_needed:
needs: generate_cache_key
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.57.0-jammy
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- uses: actions/cache/restore@v4
id: node_deps_restore_cache
with:
path: |
node_modules
e2e/node_modules
dist
key: ${{ needs.generate_cache_key.outputs.cache_key }}
- run: npm ci
if: steps.node_deps_restore_cache.outputs.cache-hit != 'true' || contains(github.event.pull_request.labels.*.name, 'build:clean')
- name: Remove build:clean label (if present)
if: contains(github.event.pull_request.labels.*.name, 'build:clean')
uses: actions/github-script@v6
with:
script: |
const { owner, repo, number } = context.issue;
const labelToRemove = 'build:clean';
try {
await github.rest.issues.removeLabel({
owner,
repo,
issue_number: number,
name: labelToRemove
});
} catch (error) {
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
}
- uses: actions/cache/save@v4
id: node_deps_save_cache
if: steps.node_deps_restore_cache.outputs.cache-hit != 'true' || contains(github.event.pull_request.labels.*.name, 'build:clean')
with:
path: |
node_modules
e2e/node_modules
dist
key: ${{ needs.generate_cache_key.outputs.cache_key }}
outputs:
cache_key: ${{ needs.generate_cache_key.outputs.cache_key }}
lint:
needs:
- build_and_cache_dependencies_if_needed
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.57.0-jammy
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- uses: actions/cache/restore@v4
with:
path: |
node_modules
e2e/node_modules
dist
key: ${{ needs.build_and_cache_dependencies_if_needed.outputs.cache_key }}
- run: npm run lint
unit-test:
needs:
- build_and_cache_dependencies_if_needed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- uses: actions/cache/restore@v4
with:
path: |
node_modules
e2e/node_modules
dist
key: ${{ needs.build_and_cache_dependencies_if_needed.outputs.cache_key }}
- run: |
mkdir -p dist/reports/tests/
npm ci
npm run test
- uses: codecov/codecov-action@v4
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/unit/lcov.info
flags: unit
name: unit-test-${{ github.run_id }}
fail_ci_if_error: false
- uses: actions/upload-artifact@v4
if: always()
with:
name: unit-test-results
path: dist/reports/tests/
if-no-files-found: warn
- uses: actions/upload-artifact@v4
if: always()
with:
name: unit-test-coverage
path: coverage
if-no-files-found: warn
- name: Collect version artifacts
if: always()
run: |
mkdir -p /tmp/artifacts
printenv NODE_ENV > /tmp/artifacts/NODE_ENV.txt || true
npm -v > /tmp/artifacts/npm-version.txt
node -v > /tmp/artifacts/node-version.txt
ls -latR > /tmp/artifacts/dir.txt
- uses: actions/upload-artifact@v4
if: always()
with:
name: unit-test-artifacts
path: /tmp/artifacts
if-no-files-found: warn
e2e-test:
name: e2e-ci (shard ${{ matrix.shard }}/4)
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.57.0-jammy
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
needs:
- build_and_cache_dependencies_if_needed
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- uses: actions/cache/restore@v4
with:
path: |
node_modules
e2e/node_modules
dist
key: ${{ needs.build_and_cache_dependencies_if_needed.outputs.cache_key }}
- run: |
mkdir -p test-results
npm run test:e2e:ci -- --shard=${{ matrix.shard }}/4
- run: npm run cov:e2e:report || true
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/e2e/lcov.info
flags: e2e-ci
name: e2e-ci-${{ github.run_id }}-shard-${{ matrix.shard }}
fail_ci_if_error: false
- uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-ci-test-results-shard-${{ matrix.shard }}
path: test-results
if-no-files-found: warn
- uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-ci-coverage-shard-${{ matrix.shard }}
path: coverage
if-no-files-found: warn
- uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-ci-html-results-shard-${{ matrix.shard }}
path: html-test-results
if-no-files-found: warn
- name: Collect version artifacts
if: always()
run: |
mkdir -p /tmp/artifacts
printenv NODE_ENV > /tmp/artifacts/NODE_ENV.txt || true
npm -v > /tmp/artifacts/npm-version.txt
node -v > /tmp/artifacts/node-version.txt
ls -latR > /tmp/artifacts/dir.txt
- uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-ci-artifacts-shard-${{ matrix.shard }}
path: /tmp/artifacts
if-no-files-found: warn
visual-a11y:
name: visual-a11y-ci
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.57.0-jammy
needs:
- build_and_cache_dependencies_if_needed
strategy:
fail-fast: false
matrix:
shard: [1, 2]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- uses: actions/cache/restore@v4
with:
path: |
node_modules
e2e/node_modules
dist
key: ${{ needs.build_and_cache_dependencies_if_needed.outputs.cache_key }}
- run: npm run test:e2e:visual:ci -- --shard=${{ matrix.shard }}/2
- uses: actions/upload-artifact@v4
if: always()
with:
name: visual-a11y-ci-test-results-shard-${{ matrix.shard }}
path: test-results
if-no-files-found: warn
- uses: actions/upload-artifact@v4
if: always()
with:
name: visual-a11y-ci-html-results-shard-${{ matrix.shard }}
path: html-test-results
if-no-files-found: warn
- name: Collect version artifacts
if: always()
run: |
mkdir -p /tmp/artifacts
printenv NODE_ENV > /tmp/artifacts/NODE_ENV.txt || true
npm -v > /tmp/artifacts/npm-version.txt
node -v > /tmp/artifacts/node-version.txt
ls -latR > /tmp/artifacts/dir.txt
- uses: actions/upload-artifact@v4
if: always()
with:
name: visual-a11y-ci-artifacts-shard-${{ matrix.shard }}
path: /tmp/artifacts
if-no-files-found: warn
perf-test:
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.57.0-jammy
needs:
- build_and_cache_dependencies_if_needed
if: ${{ always() }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- uses: actions/cache/restore@v4
with:
path: |
node_modules
e2e/node_modules
dist
key: ${{ needs.build_and_cache_dependencies_if_needed.outputs.cache_key }}
- run: npm run test:perf:localhost
- run: npm run test:perf:contract
- uses: actions/upload-artifact@v4
if: always()
with:
name: perf-test-results
path: test-results
if-no-files-found: warn
- uses: actions/upload-artifact@v4
if: always()
with:
name: perf-html-results
path: html-test-results
if-no-files-found: warn
- name: Collect version artifacts
if: always()
run: |
mkdir -p /tmp/artifacts
printenv NODE_ENV > /tmp/artifacts/NODE_ENV.txt || true
npm -v > /tmp/artifacts/npm-version.txt
node -v > /tmp/artifacts/node-version.txt
ls -latR > /tmp/artifacts/dir.txt
- uses: actions/upload-artifact@v4
if: always()
with:
name: perf-test-artifacts
path: /tmp/artifacts
if-no-files-found: warn
mem-test:
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.57.0-jammy
needs:
- build_and_cache_dependencies_if_needed
if: ${{ always() }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- uses: actions/cache/restore@v4
with:
path: |
node_modules
e2e/node_modules
dist
key: ${{ needs.build_and_cache_dependencies_if_needed.outputs.cache_key }}
- run: npm run test:perf:memory
- uses: actions/upload-artifact@v4
if: always()
with:
name: mem-test-results
path: test-results
if-no-files-found: warn
- uses: actions/upload-artifact@v4
if: always()
with:
name: mem-html-results
path: html-test-results
if-no-files-found: warn
- name: Collect version artifacts
if: always()
run: |
mkdir -p /tmp/artifacts
printenv NODE_ENV > /tmp/artifacts/NODE_ENV.txt || true
npm -v > /tmp/artifacts/npm-version.txt
node -v > /tmp/artifacts/node-version.txt
ls -latR > /tmp/artifacts/dir.txt
- uses: actions/upload-artifact@v4
if: always()
with:
name: mem-test-artifacts
path: /tmp/artifacts
if-no-files-found: warn