@@ -45,122 +45,28 @@ 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
11754 - run :
11855 name : Run tests on JSDOM
11956 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"
57+ - code-infra/upload-coverage
13358 test_lint :
13459 << : *default-job
13560 steps :
13661 - checkout
137- - install_js
62+ - code-infra/install-packages
13863 - code-infra/run-linters
13964 test_static :
14065 << : *default-job
14166 steps :
14267 - 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
68+ - code-infra/install-packages
69+ - code-infra/check-static-changes
16470 - run :
16571 name : Generate the documentation
16672 command : pnpm docs:api
@@ -187,15 +93,8 @@ jobs:
18793 resource_class : ' medium+'
18894 steps :
18995 - 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
96+ - code-infra/install-packages
97+ - code-infra/test-types
19998 - save_cache :
20099 name : Save generated declaration files
201100 key : typescript-declaration-files-{{ .Branch }}-{{ .Revision }}
@@ -207,13 +106,8 @@ jobs:
207106 resource_class : ' medium+'
208107 steps :
209108 - 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
109+ - code-infra/install-packages :
110+ typescript-version : next
217111 - run :
218112 name : Tests TypeScript definitions
219113 command : pnpm typescript
@@ -239,31 +133,19 @@ jobs:
239133 - image : mcr.microsoft.com/playwright:v1.56.1-noble
240134 steps :
241135 - checkout
242- - install_js :
136+ - code-infra/install-packages :
243137 browsers : true
244138 - run :
245139 name : Run tests on headless Chromium
246140 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"
141+ - code-infra/upload-coverage
260142 test_regressions :
261143 << : *default-job
262144 docker :
263145 - image : mcr.microsoft.com/playwright:v1.56.1-noble
264146 steps :
265147 - checkout
266- - install_js :
148+ - code-infra/install-packages :
267149 browsers : true
268150 - run :
269151 name : Run visual regression tests
@@ -277,7 +159,7 @@ jobs:
277159 - image : mcr.microsoft.com/playwright:v1.56.1-noble
278160 steps :
279161 - checkout
280- - install_js :
162+ - code-infra/install-packages :
281163 browsers : true
282164 - run :
283165 name : pnpm test:e2e
@@ -287,29 +169,11 @@ jobs:
287169 << : *default-job
288170 steps :
289171 - 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
172+ - code-infra/install-packages
173+ - code-infra/test-package
297174 - run :
298175 name : Check public types
299176 command : pnpm -r run release:test
300- - run :
301- name : Test Node.js module resolution
302- 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
313177
314178workflows :
315179 pipeline :
0 commit comments