@@ -45,122 +45,29 @@ default-context: &default-context
4545# restore_cache:
4646# key: v1-repo-{{ .Branch }}-{{ .Revision }}
4747
48- commands :
49- install_js :
50- parameters :
51- browsers :
52- type : boolean
53- default : false
54- description : ' Set to true if you intend to any browser (for example with playwright).'
55- react-version :
56- description : The version of react to be used
57- type : string
58- default : stable
59- steps :
60- - run :
61- name : Set npm registry public signing keys
62- command : |
63- echo "export COREPACK_INTEGRITY_KEYS='$(curl https://registry.npmjs.org/-/npm/v1/keys | jq -c '{npm: .keys}')'" >> $BASH_ENV
64- - when :
65- condition : << parameters.browsers >>
66- steps :
67- - run :
68- name : Install pnpm package manager
69- command : corepack enable
70- - when :
71- condition :
72- not : << parameters.browsers >>
73- steps :
74- - run :
75- name : Install pnpm package manager
76- # See https://stackoverflow.com/a/73411601
77- command : corepack enable --install-directory ~/bin
78- - run :
79- name : View install environment
80- command : |
81- node --version
82- pnpm --version
83- - run :
84- name : Install js dependencies
85- command : |
86- args=""
87- if [ -n "$REACT_VERSION" ] && [ "$REACT_VERSION" != "stable" ]; then
88- args="react@$REACT_VERSION"
89- fi
90- if [ -n "$args" ]; then
91- pnpm dlx @mui/internal-code-infra@canary set-version-overrides --pkg $args
92- else
93- pnpm install
94- fi
95- linting :
96- description : ' Runs linters'
97- steps :
98- - run :
99- name : ESLint
100- command : pnpm eslint:ci
101- - run :
102- name : Stylelint
103- command : pnpm stylelint
104- - run :
105- name : Lint Markdown
106- command : pnpm markdownlint
107- - run :
108- name : Lint writing style
109- command : pnpm valelint
110-
11148jobs :
11249 test_unit :
11350 << : *default-job
11451 steps :
11552 - checkout
116- - install_js
53+ - code-infra/install-packages :
54+ react-version : << parameters.react-version >>
11755 - run :
11856 name : Run tests on JSDOM
11957 command : pnpm test:jsdom:coverage
120- - run :
121- name : Check if coverage report is generated
122- command : |
123- if ! [[ -s coverage/lcov.info ]]
124- then
125- exit 1
126- fi
127- - run :
128- name : Upload coverage report to Codecov
129- command : |
130- curl -Os https://uploader.codecov.io/latest/linux/codecov
131- chmod +x codecov
132- ./codecov -t ${CODECOV_TOKEN} -Z -F "$REACT_VERSION-jsdom"
58+ - code-infra/upload-coverage
13359 test_lint :
13460 << : *default-job
13561 steps :
13662 - checkout
137- - install_js
63+ - code-infra/install-packages
13864 - code-infra/run-linters
13965 test_static :
14066 << : *default-job
14167 steps :
14268 - checkout
143- - install_js
144- - run :
145- name : ' `pnpm dedupe` was run?'
146- command : |
147- # #default-branch-switch
148- if [[ $(git diff --name-status master | grep -E 'pnpm-workspace\.yaml|pnpm-lock.yaml|package\.json') == "" ]];
149- then
150- echo "No changes to dependencies detected. Skipping..."
151- else
152- pnpm dedupe --check
153- fi
154- - run :
155- name : ' `pnpm prettier` changes committed?'
156- command : |
157- # #target-branch-reference
158- if [[ $(git diff --name-status master | grep pnpm-lock) == "" ]];
159- then
160- pnpm prettier --check
161- else
162- pnpm exec prettier --check . --ignore-path .lintignore
163- fi
69+ - code-infra/install-packages
70+ - code-infra/check-static-changes
16471 - run :
16572 name : Generate the documentation
16673 command : pnpm docs:api
@@ -187,15 +94,9 @@ jobs:
18794 resource_class : ' medium+'
18895 steps :
18996 - checkout
190- - install_js
191- - run :
192- name : Tests TypeScript definitions
193- command : pnpm typescript
194- environment :
195- NODE_OPTIONS : --max-old-space-size=3072
196- - run :
197- name : Any defect declaration files?
198- command : pnpm code-infra validate-built-types
97+ - code-infra/install-packages :
98+ react-version : << parameters.react-version >>
99+ - code-infra/test-types
199100 - save_cache :
200101 name : Save generated declaration files
201102 key : typescript-declaration-files-{{ .Branch }}-{{ .Revision }}
@@ -207,13 +108,8 @@ jobs:
207108 resource_class : ' medium+'
208109 steps :
209110 - checkout
210- - install_js
211- - run :
212- name : Resolve typescript version
213- command : |
214- pnpm update -r typescript@next
215- # log a patch for maintainers who want to check out this change
216- git --no-pager diff HEAD
111+ - code-infra/install-packages :
112+ typescript-version : next
217113 - run :
218114 name : Tests TypeScript definitions
219115 command : pnpm typescript
@@ -239,31 +135,20 @@ jobs:
239135 - image : mcr.microsoft.com/playwright:v1.56.1-noble
240136 steps :
241137 - checkout
242- - install_js :
138+ - code-infra/install-packages :
243139 browsers : true
140+ react-version : << parameters.react-version >>
244141 - run :
245142 name : Run tests on headless Chromium
246143 command : pnpm test:chromium --coverage
247- - run :
248- name : Check if coverage report is generated
249- command : |
250- if ! [[ -s coverage/lcov.info ]]
251- then
252- exit 1
253- fi
254- - run :
255- name : Upload coverage report to Codecov
256- command : |
257- curl -Os https://uploader.codecov.io/latest/linux/codecov
258- chmod +x codecov
259- ./codecov -t ${CODECOV_TOKEN} -Z -F "$REACT_VERSION-browser"
144+ - code-infra/upload-coverage
260145 test_regressions :
261146 << : *default-job
262147 docker :
263148 - image : mcr.microsoft.com/playwright:v1.56.1-noble
264149 steps :
265150 - checkout
266- - install_js :
151+ - code-infra/install-packages :
267152 browsers : true
268153 - run :
269154 name : Run visual regression tests
@@ -277,7 +162,7 @@ jobs:
277162 - image : mcr.microsoft.com/playwright:v1.56.1-noble
278163 steps :
279164 - checkout
280- - install_js :
165+ - code-infra/install-packages :
281166 browsers : true
282167 - run :
283168 name : pnpm test:e2e
@@ -287,29 +172,14 @@ jobs:
287172 << : *default-job
288173 steps :
289174 - checkout
290- - install_js
291- - run :
292- name : Build packages
293- command : pnpm release:build
294- - run :
295- name : Validate type declarations
296- command : pnpm code-infra validate-built-types
175+ - code-infra/install-packages
176+ - code-infra/test-package
297177 - run :
298178 name : Check public types
299179 command : pnpm -r run release:test
300180 - run :
301181 name : Test Node.js module resolution
302182 command : pnpm -F @base-ui/test-node-resolution test
303- - run :
304- name : Verify built packages
305- command : pnpm -r test:package
306- - run :
307- name : create and upload a size snapshot
308- command : |
309- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID_ARTIFACTS
310- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY_ARTIFACTS
311- export AWS_REGION=$AWS_REGION_ARTIFACTS
312- pnpm size:snapshot
313183
314184workflows :
315185 pipeline :
0 commit comments