-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
345 lines (313 loc) · 8.09 KB
/
.gitlab-ci.yml
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
image: node:latest
include:
- template: Jobs/Dependency-Scanning.gitlab-ci.yml
- template: Jobs/Secret-Detection.gitlab-ci.yml
variables:
FORCE_DEPLOY_DOCS:
value: "no"
options:
- "yes"
- "no"
description: 'Force documentation to be redeployed. Ensure no commits references documentation about non-released features. Only relevant on "master"'
stages:
- prepare
- build
- test
- compatibility
- release
- postrelease
secret_detection:
needs:
- Build
dependencies:
- Build
variables:
SECRET_DETECTION_EXCLUDED_PATHS: node_modules
NPM:
stage: prepare
artifacts:
name: ${CI_PROJECT_PATH_SLUG}-${CI_PIPELINE_ID}-npm
paths:
- .husky/
- node_modules/
- docs/node_modules/
- tests/vitest/node_modules/
reports:
dependency_scanning: gl-dependency-scanning.json
script:
- node --version
- npm --version
- npm ci --no-fund --no-audit --no-update-notifier
- npm audit --json --production | npx --yes gitlab-npm-audit-parser -o gl-dependency-scanning.json || true
- npx sort-package-json --check
Build:
stage: build
artifacts:
name: ${CI_PROJECT_PATH_SLUG}-${CI_PIPELINE_ID}-build
when: always
paths:
- dist/
- src/generated/
- temp/
script:
- npm run --if-present build
- npm pack
- npm exec npm-pkg-lint -- --ignore-node-version=16
- |
for dts in dist/{cjs,es}/{index,browser,jest,test-utils}.d.ts; do
if [[ ! -e "${dts}" ]]; then
echo "${dts}" is missing from package
exit 1
fi
done
pages:
stage: build
artifacts:
paths:
- public
rules:
- if: '$CI_COMMIT_REF_NAME == "master" && $CI_COMMIT_MESSAGE =~ /^chore\(release\):/'
- if: '$CI_COMMIT_REF_NAME == "master" && $FORCE_DEPLOY_DOCS == "yes"'
script:
- npm run --if-present build
- npm run docs
Changelog:
stage: test
needs:
- NPM
dependencies:
- NPM
script:
- npm exec commitlint -- --from=origin/master --to=${CI_COMMIT_SHA}
ESLint:
stage: test
needs:
- NPM
- Build
script:
- npm run codegen
- npm run eslint -- --max-warnings 0
Jest:
stage: test
dependencies:
- NPM
needs:
- NPM
coverage: /Branches\s+:\s+([\d\.]+%)/
artifacts:
name: ${CI_PROJECT_PATH_SLUG}-${CI_PIPELINE_ID}-coverage
paths:
- coverage
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
junit: temp/jest.xml
script:
- npm run codegen
- npm test -- src/ tests/
Prettier:
stage: test
needs:
- NPM
dependencies:
- NPM
script:
- npm run prettier:check
Docs:
stage: test
artifacts:
reports:
junit: temp/jest.xml
script:
- npm run codegen
- npm run docs
- npm run htmlvalidate -- --formatter codeframe --config docs/htmlvalidate-public.json 'public/**/*.html'
- npm test -- docs
- npm exec eslint docs/examples
- git status
- test -z "$(git status --porcelain)" || (echo 'working copy dirty, need to commit updated specs'; exit 1)
.compat:
stage: compatibility
dependencies: []
needs: []
before_script:
- npm ci --no-fund --no-audit --no-update-notifier
script:
- npm run codegen
- npm test -- --no-coverage --testPathIgnorePatterns matchers tests/jest tests/vitest
- npm run --if-present build
- npm run compatibility
Node:
extends: .compat
parallel:
matrix:
- VERSION:
- 16
- 18
- 20
image: node:${VERSION}
Jest compat:
stage: compatibility
dependencies: []
needs: []
parallel:
matrix:
- MATRIX:
- 27
- 28
- 29
before_script:
- npm ci --no-fund --no-audit --no-update-notifier
- npm run build
- npm pkg delete workspaces
- export TYPES_VERSION=$(node scripts/get-min-version.js "${MATRIX}" "@types/jest")
- export JEST_VERSION=$(node scripts/get-min-version.js "${MATRIX}" "jest")
- export TS_JEST_VERSION=$(node scripts/get-min-version.js "${MATRIX}" "ts-jest")
- export TS_VERSION=$(node scripts/get-min-version.js "${MATRIX}" "typescript")
- |
echo "jest version: ${JEST_VERSION}"
echo "typescript version: ${TS_VERSION}"
echo "@types version: ${TYPES_VERSION}"
- >
npm rm rollup-plugin-dts
- >
npm install
@jest/core@${JEST_VERSION}
jest@${JEST_VERSION}
jest-circus@${JEST_VERSION}
jest-diff@${JEST_VERSION}
jest-environment-jsdom@${JEST_VERSION}
jest-runtime@${JEST_VERSION}
jest-snapshot@${JEST_VERSION}
ts-jest@${TS_JEST_VERSION}
typescript@${TS_VERSION}
@types/jest@${TYPES_VERSION}
- if [[ "${MATRIX}" -ge "28" ]]; then npm install @jest/expect@${JEST_VERSION}; fi
- npm dedupe
- >
npm ls
@jest/core
@jest/expect
jest
jest-circus
jest-diff
jest-environment-jsdom
jest-runtime
jest-snapshot
pretty-format
ts-jest
typescript
@types/jest
script:
- sed 's#/src/browser.ts#/dist/cjs/browser.js#g' -i package.json
# older jest/ts-jest versions doesn't work with bundler so use nodenext instead
- sed '/moduleResolution/s/bundler/nodenext/' -i tsconfig.json
- if [[ "${MATRIX}" -eq "25" ]]; then sed -i '/"paths"/i"baseUrl":"./",' tsconfig.json; fi
- for spec in tests/jest/*.spec.ts; do sed 's#../../src#../../dist/cjs#g' -i "${spec}"; done
- npm exec jest -- --no-coverage --ci -- tests/jest
Vitest compat:
stage: compatibility
dependencies: []
needs: []
parallel:
matrix:
- VERSION:
- 0
- 1
before_script:
- npm ci --no-fund --no-audit --no-update-notifier
- npm run build
- npm install --no-save @types/node@18 $(npx -y npm-min-peer vitest --major ${VERSION} --with-name)
script:
- npm run -w tests/vitest test
Module:
stage: compatibility
dependencies:
- NPM
- Build
needs:
- NPM
- Build
parallel:
matrix:
- BUILD:
- esm
- cjs
before_script:
- (cd tests/integration/${BUILD} && npm install)
script:
- npm exec tsc -- --build tests/integration/${BUILD}
- node tests/integration/${BUILD}
.release:
stage: release
variables:
GIT_AUTHOR_NAME: ${GITLAB_USER_NAME}
GIT_AUTHOR_EMAIL: ${GITLAB_USER_EMAIL}
GIT_COMMITTER_NAME: ${HTML_VALIDATE_BOT_NAME}
GIT_COMMITTER_EMAIL: ${HTML_VALIDATE_BOT_EMAIL}
before_script:
- npm install -g $(node -p 'require("./package.json").release.extends')
- node --version
Dry run:
extends: .release
needs: []
dependencies: []
rules:
- if: '$CI_COMMIT_REF_NAME == "master"'
- if: '$CI_COMMIT_REF_NAME =~ /^release\//'
script:
- npm exec semantic-release -- --dry-run
Release:
extends: .release
tags:
- saas-linux-small-amd64
id_tokens:
SIGSTORE_ID_TOKEN:
aud: sigstore
rules:
- if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "web"'
when: manual
- if: '$CI_COMMIT_REF_NAME =~ /^release\// && $CI_PIPELINE_SOURCE == "web"'
when: manual
script:
- npm exec semantic-release
.downstream: &downstream
stage: postrelease
only:
- tags
variables:
UPSTREAM_VERSION: "${CI_COMMIT_TAG}"
cypress-html-validate:
<<: *downstream
trigger: html-validate/cypress-html-validate
demo:
<<: *downstream
trigger: html-validate/demo
example-plugin:
<<: *downstream
trigger: html-validate/example-plugin
grunt-html-validate:
<<: *downstream
trigger: html-validate/grunt-html-validate
html-validate-angular:
<<: *downstream
trigger: html-validate/html-validate-angular
html-validate-jest-snapshot:
<<: *downstream
trigger: html-validate/html-validate-jest-snapshot
html-validate-vue:
<<: *downstream
trigger: html-validate/html-validate-vue
html-validate-vue-webpack-plugin:
<<: *downstream
trigger: html-validate/html-validate-vue
protractor-html-validate:
<<: *downstream
trigger: html-validate/protractor-html-validate
try-online:
<<: *downstream
trigger: html-validate/try-online
vue-cli-plugin-html-validate:
<<: *downstream
trigger: html-validate/vue-cli-plugin-html-validate