11version : 2.1
22
3+ orbs :
4+ code-infra : https://raw.githubusercontent.com/mui/mui-public/refs/heads/ci-orb/.circleci/orbs/code-infra.yaml
5+
36parameters :
47 browserstack-force :
58 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.
@@ -23,7 +26,6 @@ default-job: &default-job
2326 environment :
2427 # expose it globally otherwise we have to thread it from each job to the install command
2528 BROWSERSTACK_FORCE : << pipeline.parameters.browserstack-force >>
26- REACT_VERSION : << parameters.react-version >>
2729 COREPACK_ENABLE_DOWNLOAD_PROMPT : ' 0'
2830 working_directory : /tmp/base-ui
2931 docker :
@@ -42,115 +44,29 @@ default-context: &default-context
4244# restore_cache:
4345# key: v1-repo-{{ .Branch }}-{{ .Revision }}
4446
45- commands :
46- install_js :
47- parameters :
48- browsers :
49- type : boolean
50- default : false
51- description : ' Set to true if you intend to any browser (for example with playwright).'
52- react-version :
53- description : The version of react to be used
54- type : string
55- default : stable
56- steps :
57- - run :
58- name : Set npm registry public signing keys
59- command : |
60- echo "export COREPACK_INTEGRITY_KEYS='$(curl https://registry.npmjs.org/-/npm/v1/keys | jq -c '{npm: .keys}')'" >> $BASH_ENV
61- - when :
62- condition : << parameters.browsers >>
63- steps :
64- - run :
65- name : Install pnpm package manager
66- command : corepack enable
67- - when :
68- condition :
69- not : << parameters.browsers >>
70- steps :
71- - run :
72- name : Install pnpm package manager
73- # See https://stackoverflow.com/a/73411601
74- command : corepack enable --install-directory ~/bin
75- - run :
76- name : View install environment
77- command : |
78- node --version
79- pnpm --version
80- - run :
81- name : Install js dependencies
82- command : |
83- args=""
84- if [ -n "$REACT_VERSION" ] && [ "$REACT_VERSION" != "stable" ]; then
85- args="react@$REACT_VERSION"
86- fi
87- if [ -n "$args" ]; then
88- pnpm dlx @mui/internal-code-infra@canary set-version-overrides --pkg $args
89- else
90- pnpm install
91- fi
92-
9347jobs :
9448 test_unit :
9549 << : *default-job
9650 steps :
9751 - checkout
98- - install_js
52+ - code-infra/install-deps :
53+ package-overrides : react@<< parameters.react-version >>
9954 - run :
10055 name : Run tests on JSDOM
10156 command : pnpm test:jsdom:coverage
102- - run :
103- name : Check if coverage report is generated
104- command : |
105- if ! [[ -s coverage/lcov.info ]]
106- then
107- exit 1
108- fi
109- - run :
110- name : Upload coverage report to Codecov
111- command : |
112- curl -Os https://uploader.codecov.io/latest/linux/codecov
113- chmod +x codecov
114- ./codecov -t ${CODECOV_TOKEN} -Z -F "$REACT_VERSION-jsdom"
57+ - code-infra/upload-coverage
11558 test_lint :
11659 << : *default-job
11760 steps :
11861 - checkout
119- - install_js
120- - run :
121- name : ' `pnpm prettier` changes committed?'
122- command : |
123- # #target-branch-reference
124- if [[ $(git diff --name-status master | grep pnpm-lock) == "" ]];
125- then
126- pnpm prettier --check
127- else
128- pnpm exec prettier --check . --ignore-path .lintignore
129- fi
130- - run :
131- name : ESLint
132- command : pnpm eslint:ci
133- - run :
134- name : Stylelint
135- command : pnpm stylelint
136- - run :
137- name : Lint Markdown
138- command : pnpm markdownlint
62+ - code-infra/install-deps
63+ - 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
68+ - code-infra/install-deps
69+ - code-infra/check-static-changes
15470 - run :
15571 name : Generate the documentation
15672 command : pnpm docs:api
17793 resource_class : ' medium+'
17894 steps :
17995 - checkout
180- - install_js
96+ - code-infra/install-deps :
97+ package-overrides : react@<< parameters.react-version >>
18198 - run :
18299 name : Tests TypeScript definitions
183100 command : pnpm typescript
@@ -197,13 +114,8 @@ jobs:
197114 resource_class : ' medium+'
198115 steps :
199116 - checkout
200- - install_js
201- - run :
202- name : Resolve typescript version
203- command : |
204- pnpm update -r typescript@next
205- # log a patch for maintainers who want to check out this change
206- git --no-pager diff HEAD
117+ - code-infra/install-deps :
118+ package-overrides : typescript@next
207119 - run :
208120 name : Tests TypeScript definitions
209121 command : pnpm typescript
@@ -229,31 +141,20 @@ jobs:
229141 - image : mcr.microsoft.com/playwright:v1.56.1-noble
230142 steps :
231143 - checkout
232- - install_js :
144+ - code-infra/install-deps :
145+ package-overrides : react@<< parameters.react-version >>
233146 browsers : true
234147 - run :
235148 name : Run tests on headless Chromium
236149 command : pnpm test:chromium --coverage
237- - run :
238- name : Check if coverage report is generated
239- command : |
240- if ! [[ -s coverage/lcov.info ]]
241- then
242- exit 1
243- fi
244- - run :
245- name : Upload coverage report to Codecov
246- command : |
247- curl -Os https://uploader.codecov.io/latest/linux/codecov
248- chmod +x codecov
249- ./codecov -t ${CODECOV_TOKEN} -Z -F "$REACT_VERSION-browser"
150+ - code-infra/upload-coverage
250151 test_regressions :
251152 << : *default-job
252153 docker :
253154 - image : mcr.microsoft.com/playwright:v1.56.1-noble
254155 steps :
255156 - checkout
256- - install_js :
157+ - code-infra/install-deps :
257158 browsers : true
258159 - run :
259160 name : Run visual regression tests
@@ -267,7 +168,7 @@ jobs:
267168 - image : mcr.microsoft.com/playwright:v1.56.1-noble
268169 steps :
269170 - checkout
270- - install_js :
171+ - code-infra/install-deps :
271172 browsers : true
272173 - run :
273174 name : pnpm test:e2e
@@ -277,29 +178,14 @@ jobs:
277178 << : *default-job
278179 steps :
279180 - checkout
280- - install_js
281- - run :
282- name : Build packages
283- command : pnpm release:build
284- - run :
285- name : Validate type declarations
286- command : pnpm code-infra validate-built-types
181+ - code-infra/install-deps
182+ - code-infra/test-package
287183 - run :
288184 name : Check public types
289185 command : pnpm -r run release:test
290186 - run :
291187 name : Test Node.js module resolution
292188 command : pnpm -F @base-ui/test-node-resolution test
293- - run :
294- name : Verify built packages
295- command : pnpm -r test:package
296- - run :
297- name : create and upload a size snapshot
298- command : |
299- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID_ARTIFACTS
300- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY_ARTIFACTS
301- export AWS_REGION=$AWS_REGION_ARTIFACTS
302- pnpm size:snapshot
303189
304190workflows :
305191 pipeline :
0 commit comments