diff --git a/.circleci/config.yml b/.circleci/config.yml index 18df5037a6e..ea06aa974b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,5 +1,8 @@ version: 2.1 +orbs: + code-infra: https://raw.githubusercontent.com/mui/mui-public/refs/heads/ci-orb/.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. @@ -23,11 +26,9 @@ default-job: &default-job environment: # expose it globally otherwise we have to thread it from each job to the install command BROWSERSTACK_FORCE: << pipeline.parameters.browserstack-force >> - REACT_VERSION: << parameters.react-version >> COREPACK_ENABLE_DOWNLOAD_PROMPT: '0' working_directory: /tmp/base-ui - docker: - - image: cimg/node:22.18 + executor: code-infra/mui-node default-context: &default-context context: @@ -42,115 +43,30 @@ default-context: &default-context # restore_cache: # key: v1-repo-{{ .Branch }}-{{ .Revision }} -commands: - install_js: - parameters: - browsers: - type: boolean - default: false - description: 'Set to true if you intend to any browser (for example with playwright).' - react-version: - description: The version of react to be used - type: string - default: stable - steps: - - run: - name: Set npm registry public signing keys - command: | - echo "export COREPACK_INTEGRITY_KEYS='$(curl https://registry.npmjs.org/-/npm/v1/keys | jq -c '{npm: .keys}')'" >> $BASH_ENV - - when: - condition: << parameters.browsers >> - steps: - - run: - name: Install pnpm package manager - command: corepack enable - - when: - condition: - not: << parameters.browsers >> - steps: - - run: - name: Install pnpm package manager - # See https://stackoverflow.com/a/73411601 - command: corepack enable --install-directory ~/bin - - run: - name: View install environment - command: | - node --version - pnpm --version - - run: - name: Install js dependencies - command: | - args="" - if [ -n "$REACT_VERSION" ] && [ "$REACT_VERSION" != "stable" ]; then - args="react@$REACT_VERSION" - fi - if [ -n "$args" ]; then - pnpm dlx @mui/internal-code-infra@canary set-version-overrides --pkg $args - else - pnpm install - fi - jobs: test_unit: <<: *default-job steps: - checkout - - install_js + - code-infra/install-deps: + package-overrides: react@<< parameters.react-version >> - run: name: Run tests on JSDOM command: pnpm test:jsdom:coverage - - run: - name: Check if coverage report is generated - command: | - if ! [[ -s coverage/lcov.info ]] - then - exit 1 - fi - - run: - name: Upload coverage report to Codecov - command: | - curl -Os https://uploader.codecov.io/latest/linux/codecov - chmod +x codecov - ./codecov -t ${CODECOV_TOKEN} -Z -F "$REACT_VERSION-jsdom" + - code-infra/upload-coverage: + key: << parameters.react-version >>-jsdom test_lint: <<: *default-job steps: - checkout - - install_js - - run: - name: '`pnpm prettier` changes committed?' - command: | - # #target-branch-reference - if [[ $(git diff --name-status master | grep pnpm-lock) == "" ]]; - then - pnpm prettier --check - else - pnpm exec prettier --check . --ignore-path .lintignore - fi - - run: - name: ESLint - command: pnpm eslint:ci - - run: - name: Stylelint - command: pnpm stylelint - - run: - name: Lint Markdown - command: pnpm markdownlint + - code-infra/install-deps + - code-infra/run-linters test_static: <<: *default-job steps: - checkout - - install_js - - run: - name: '`pnpm dedupe` was run?' - command: | - # #default-branch-switch - if [[ $(git diff --name-status master | grep -E 'pnpm-workspace\.yaml|pnpm-lock.yaml|package\.json') == "" ]]; - then - echo "No changes to dependencies detected. Skipping..." - else - pnpm dedupe --check - fi + - code-infra/install-deps + - code-infra/check-static-changes - run: name: Generate the documentation command: pnpm docs:api @@ -177,7 +93,8 @@ jobs: resource_class: 'medium+' steps: - checkout - - install_js + - code-infra/install-deps: + package-overrides: react@<< parameters.react-version >> - run: name: Tests TypeScript definitions command: pnpm typescript @@ -197,13 +114,8 @@ jobs: resource_class: 'medium+' steps: - checkout - - install_js - - run: - name: Resolve typescript version - command: | - pnpm update -r typescript@next - # log a patch for maintainers who want to check out this change - git --no-pager diff HEAD + - code-infra/install-deps: + package-overrides: typescript@next - run: name: Tests TypeScript definitions command: pnpm typescript @@ -229,31 +141,21 @@ jobs: - image: mcr.microsoft.com/playwright:v1.56.1-noble steps: - checkout - - install_js: + - code-infra/install-deps: + package-overrides: react@<< parameters.react-version >> browsers: true - run: name: Run tests on headless Chromium command: pnpm test:chromium --coverage - - run: - name: Check if coverage report is generated - command: | - if ! [[ -s coverage/lcov.info ]] - then - exit 1 - fi - - run: - name: Upload coverage report to Codecov - command: | - curl -Os https://uploader.codecov.io/latest/linux/codecov - chmod +x codecov - ./codecov -t ${CODECOV_TOKEN} -Z -F "$REACT_VERSION-browser" + - code-infra/upload-coverage: + key: << parameters.react-version >>-browser test_regressions: <<: *default-job docker: - image: mcr.microsoft.com/playwright:v1.56.1-noble steps: - checkout - - install_js: + - code-infra/install-deps: browsers: true - run: name: Run visual regression tests @@ -267,7 +169,7 @@ jobs: - image: mcr.microsoft.com/playwright:v1.56.1-noble steps: - checkout - - install_js: + - code-infra/install-deps: browsers: true - run: name: pnpm test:e2e @@ -277,7 +179,7 @@ jobs: <<: *default-job steps: - checkout - - install_js + - code-infra/install-deps - run: name: Build packages command: pnpm release:build @@ -293,13 +195,7 @@ jobs: - run: name: Verify built packages command: pnpm -r test:package - - run: - name: create and upload a size snapshot - command: | - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID_ARTIFACTS - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY_ARTIFACTS - export AWS_REGION=$AWS_REGION_ARTIFACTS - pnpm size:snapshot + - code-infra/upload-size-snapshot workflows: pipeline: diff --git a/README.md b/README.md index b02a8f7a296..ec6f45dc322 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ To see the latest updates, check out the [releases](https://base-ui.com/react/ov - **Michał Dudak** (Material UI) [@michaldudak](https://x.com/michaldudak) - **Marija Najdova** (Material UI + Fluent UI) [@marijanajdova](https://x.com/marijanajdova) - **Albert Yu** (Material UI) [@mj12albert](https://github.com/mj12albert) -- **Lukas Tyla** (Material UI) [@LukasTy](https://github.com/LukasTy) +- **Lukas Tyla** (Material UI) [@LukasTy](https://github.com/LukasTy) ## License