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
371version: 2.1
orbs:
code-infra: https://raw.githubusercontent.com/mui/mui-public/877573f0cfcf5da40f459e69bdd9667a7c12addd/.circleci/orbs/code-infra.yml
parameters:
browserstack-force:
description: Whether to force browserstack usage. We have limited resources on browserstack so the pipeline might decide to skip browserstack if this parameter isn't set to true.
type: boolean
default: false
react-version:
description: The version of react to be used
type: string
default: stable
workflow:
description: The name of the workflow to run
type: string
default: pipeline
material-ui-version:
description: The version of material-ui to be used
type: string
default: stable
with-react-version:
description: The version of react to be used for the additional tests
type: string
default: stable
e2e-base-url:
description: The base url for running end-to-end test
type: string
default: ''
default-parameters: &default-parameters
react-version:
description: The version of react to be used
type: string
default: << pipeline.parameters.react-version >>
material-ui-version:
description: The version of material-ui to be used
type: string
default: << pipeline.parameters.material-ui-version >>
e2e-base-url:
description: The base url for running end-to-end test
type: string
default: << pipeline.parameters.e2e-base-url >>
default-job: &default-job
parameters:
<<: *default-parameters
environment:
# expose it globally otherwise we have to thread it from each job to the install command
BROWSERSTACK_FORCE: << pipeline.parameters.browserstack-force >>
COREPACK_ENABLE_DOWNLOAD_PROMPT: '0'
working_directory: /tmp/mui
executor: code-infra/mui-node
# CircleCI has disabled the cache across forks for security reasons.
# Following their official statement, it was a quick solution, they
# are working on providing this feature back with appropriate security measures.
# https://discuss.circleci.com/t/saving-cache-stopped-working-warning-skipping-this-step-disabled-in-configuration/24423/21
#
# restore_repo: &restore_repo
# restore_cache:
# key: v1-repo-{{ .Branch }}-{{ .Revision }}
default-context: &default-context
context:
- org-global
commands:
install-deps:
parameters:
react-version:
type: string
default: << pipeline.parameters.react-version >>
steps:
- code-infra/install-deps:
package-overrides: react@<< parameters.react-version >> @mui/material@<< pipeline.parameters.material-ui-version >>
jobs:
checkout:
<<: *default-job
steps:
- checkout
- install-deps
- run:
name: Should not have any git not staged
command: git add -A && git diff --exit-code --staged
test_unit:
<<: *default-job
steps:
- checkout
- install-deps:
react-version: << parameters.react-version >>
- run:
name: Test JSDOM
command: |
# Fully saturate all the available CPUs by splitting the tests in 1 shard per CPU
pnpm exec concurrently "pnpm test:unit:jsdom --reporter=blob --reporter=dot --shard=1/2" "pnpm test:unit:jsdom --reporter=blob --reporter=dot --shard=2/2" || TEST_EXIT_CODE=$?
pnpm exec vitest run --merge-reports
# Reports merged, we can now exit with the stored code
exit ${TEST_EXIT_CODE:-0}
- store_test_results:
path: test-results
test_browser:
<<: *default-job
executor:
name: code-infra/mui-node-browser
playwright-img-version: v1.57.0-noble
resource_class: large
steps:
- checkout
- install-deps:
react-version: << parameters.react-version >>
- when:
condition:
not:
equal: ['stable', << parameters.react-version >>]
steps:
- run:
environment:
TZ: UTC
PLAYWRIGHT_SERVER_WS: 'ws://127.0.0.1:9050/mui-browser'
name: Test Browser
command: |
node ./scripts/playwrightLaunchServer.mjs & pnpm test:unit:browser
- when:
condition:
equal: ['stable', << parameters.react-version >>]
steps:
- run:
name: Test Browser + Coverage
environment:
TZ: UTC
PLAYWRIGHT_SERVER_WS: 'ws://127.0.0.1:9050/mui-browser'
command: |
node ./scripts/playwrightLaunchServer.mjs & pnpm test:unit:browser --coverage
- code-infra/upload-coverage:
key: << parameters.react-version >>-browser
- store_test_results:
path: test-results
test_lint:
<<: *default-job
steps:
- checkout
- install-deps
- code-infra/run-linters
test_static:
<<: *default-job
steps:
- checkout
- install-deps
- code-infra/check-static-changes
- run:
name: Generate PropTypes
command: pnpm proptypes
environment:
NODE_OPTIONS: --max-old-space-size=3584
- run:
name: '`pnpm proptypes` changes committed?'
command: git add -A && git diff --exit-code --staged
- run:
name: Generate the documentation
command: pnpm docs:api
environment:
NODE_OPTIONS: --max-old-space-size=3584
- run:
name: '`pnpm docs:api` changes committed?'
command: git add -A && git diff --exit-code --staged
- run:
name: Sync locale files
command: pnpm l10n
- run:
name: '`pnpm l10n` changes committed?'
command: git add -A && git diff --exit-code --staged
- run:
name: '`pnpm @mui/x-charts-vendor build` was run?'
command: |
# #target-branch-reference
# Replace `master` with the new branch `vX.x` when creating the first PR on the vX.x branch
# For example, when creating v9 from v8, `master -> v8.x`
if [[ $(git diff --name-status master | grep pnpm-lock) == "" ]];
then
echo "No changes to dependencies detected. Skipping..."
else
pnpm --filter @mui/x-charts-vendor build
git add -A && git diff --exit-code --staged
fi
- run:
name: 'No dynamic date library import in the Pickers built types?'
command: |
pnpm lerna run --include-dependencies --scope "@mui/x-date-pickers*" build
if grep -nr 'import("luxon")\|import("dayjs")\|import("moment")' --exclude Adapter*.d.ts packages/{x-date-pickers,x-date-pickers-pro}/build
then
exit 1
else
exit 0
fi
- run:
name: '`pnpm generate:exports` was run?'
command: |
pnpm generate:exports
git add -A && git diff --exit-code --staged
test_types:
<<: *default-job
steps:
- checkout
- install-deps
- run:
name: Transpile TypeScript demos
command: pnpm docs:typescript:formatted --disable-cache
- run:
name: '`pnpm docs:typescript:formatted` changes committed?'
command: git add -A && git diff --exit-code --staged docs/src docs/data
- run:
name: Tests TypeScript definitions
command: pnpm typescript:ci
environment:
NODE_OPTIONS: --max-old-space-size=3584
test_e2e:
<<: *default-job
executor:
name: code-infra/mui-node-browser
playwright-img-version: v1.57.0-noble
steps:
- checkout
- install-deps:
react-version: << parameters.react-version >>
- run:
name: Build packages
command: pnpm release:build
- run:
name: Run e2e tests
command: pnpm test:e2e
test_e2e_website:
<<: *default-job
executor:
name: code-infra/mui-node-browser
playwright-img-version: v1.57.0-noble
steps:
- checkout
- install-deps
- run:
name: pnpm test:e2e-website
command: pnpm test:e2e-website
environment:
PLAYWRIGHT_TEST_BASE_URL: << parameters.e2e-base-url >>
test_package:
<<: *default-job
steps:
- checkout
- install-deps:
react-version: << parameters.react-version >>
- run:
name: prepare danger on PRs
command: pnpm danger ci
environment:
DANGER_COMMAND: prepareBundleSizeReport
- run:
name: Build packages
command: pnpm release:build
- code-infra/upload-size-snapshot
- run:
name: Run danger on PRs
command: pnpm danger ci --fail-on-errors
environment:
DANGER_COMMAND: reportBundleSize
test_regressions:
<<: *default-job
executor:
name: code-infra/mui-node-browser
playwright-img-version: v1.57.0-noble
steps:
- checkout
- install-deps:
react-version: << parameters.react-version >>
- run:
name: Install ffmpeg
command: apt update && apt upgrade -y && apt install ffmpeg -y
- run:
name: Build packages
command: pnpm release:build
- run:
name: Run visual regression tests
command: xvfb-run pnpm test:regressions
- run:
name: Upload screenshots to Argos CI
command: pnpm test:argos
workflows:
pipeline:
when:
equal: [pipeline, << pipeline.parameters.workflow >>]
jobs:
- checkout:
<<: *default-context
- test_unit:
<<: *default-context
- test_browser:
<<: *default-context
- test_lint:
<<: *default-context
- test_static:
<<: *default-context
- test_types:
<<: *default-context
- test_e2e:
<<: *default-context
- test_regressions:
<<: *default-context
- test_package:
<<: *default-context
e2e-website:
when:
equal: [e2e-website, << pipeline.parameters.workflow >>]
jobs:
- checkout:
<<: *default-context
- test_e2e_website
additional-tests:
when:
and:
- equal: [additional, << pipeline.parameters.workflow >>]
- or:
- not:
equal: ['stable', << pipeline.parameters.material-ui-version >>]
- not:
equal: ['stable', << pipeline.parameters.with-react-version >>]
jobs:
- test_unit:
<<: *default-context
name: test_unit_additional
react-version: << pipeline.parameters.with-react-version >>
- test_browser:
<<: *default-context
name: test_browser_additional
react-version: << pipeline.parameters.with-react-version >>
- test_regressions:
<<: *default-context
name: test_regressions_additional
react-version: << pipeline.parameters.with-react-version >>
- test_e2e:
<<: *default-context
name: test_e2e_additional
react-version: << pipeline.parameters.with-react-version >>
additional-checks:
when:
and:
- equal: [additional, << pipeline.parameters.workflow >>]
- not:
equal: ['stable', << pipeline.parameters.material-ui-version >>]
jobs:
- test_types:
<<: *default-context
name: test_types_additional
test-react-18:
when:
equal: [pipeline, << pipeline.parameters.workflow >>]
jobs:
- test_unit:
<<: *default-context
name: test_unit_react_18
react-version: ^18
- test_browser:
<<: *default-context
name: test_browser_react_18
react-version: ^18
- test_e2e:
<<: *default-context
name: test_e2e_react_18
react-version: ^18