version: 2.1 orbs: aws-cli: circleci/aws-cli@5.4.1 aws-s3: circleci/aws-s3@4.1.3 code-infra: https://raw.githubusercontent.com/mui/mui-public/39dc8ce86d032c503f47dcd369a4f903b6d3a985/.circleci/orbs/code-infra.yml parameters: workflow: description: The name of the workflow to run type: string default: pipeline e2e-base-url: description: The base url for running end-to-end test type: string default: '' default-job: &default-job parameters: react-version: description: The version of react to be used type: string default: stable typescript-version: description: The version of typescript to be used type: string default: stable e2e-base-url: description: The base url for running end-to-end test type: string default: << pipeline.parameters.e2e-base-url >> environment: AWS_REGION_ARTIFACTS: eu-central-1 COREPACK_ENABLE_DOWNLOAD_PROMPT: '0' DANGER_DISABLE_TRANSPILATION: 'true' working_directory: /tmp/material-ui executor: name: code-infra/mui-node node-version: '22.18' default-context: &default-context context: - org-global # 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 }} commands: install-deps: parameters: ignore-workspace: type: boolean default: false react-version: type: string default: stable typescript-version: type: string default: stable playwright-version: type: string default: stable steps: - code-infra/install-deps: package-overrides: react@<< parameters.react-version >> typescript@<< parameters.typescript-version >> @playwright/test@<< parameters.playwright-version >> playwright@<< parameters.playwright-version >> ignore-workspace: << parameters.ignore-workspace >> jobs: test_unit: <<: *default-job steps: - checkout - install-deps: react-version: << parameters.react-version >> - run: name: Tests fake browser command: pnpm test:node --no-isolate --no-file-parallelism --coverage - run: name: internal-scripts command: | # latest commit LATEST_COMMIT=$(git rev-parse HEAD) # latest commit where internal-scripts was changed FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff packages-internal/scripts) if [ $FOLDER_COMMIT = $LATEST_COMMIT ]; then echo "changes, let's run the tests" pnpm --filter @mui/internal-scripts test else echo "no changes" fi - code-infra/upload-coverage: key: '<< parameters.react-version >>-jsdom' - 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 - run: name: '`pnpm proptypes` changes committed?' command: git add -A && git diff --exit-code --staged - run: name: Generate the documentation command: pnpm docs:api - run: name: '`pnpm docs:api` changes committed?' command: git add -A && git diff --exit-code --staged - run: name: Update the navigation translations command: pnpm docs:i18n - run: name: '`pnpm docs:i18n` changes committed?' command: git add -A && git diff --exit-code --staged - run: name: '`pnpm extract-error-codes` changes committed?' command: | pnpm extract-error-codes git add -A && git diff --exit-code --staged test_types: <<: *default-job resource_class: 'medium+' steps: - checkout - install-deps - run: name: Transpile TypeScript demos command: pnpm docs:typescript:formatted - run: name: '`pnpm docs:typescript:formatted` changes committed?' command: git add -A && git diff --exit-code --staged - run: name: Tests TypeScript definitions command: pnpm typescript:ci environment: NODE_OPTIONS: --max-old-space-size=3072 - run: name: Test module augmentation command: pnpm typescript:module-augmentation test_types_next: <<: *default-job resource_class: 'medium+' steps: - checkout - install-deps: typescript-version: << parameters.typescript-version >> - run: name: Tests TypeScript definitions command: pnpm typescript:ci environment: NODE_OPTIONS: --max-old-space-size=3072 - run: name: Prepare files # Enable configuration that is only valid in typescript@next command: sed -i 's|// ||g' test/moduleResolution/tsconfig.node.json - run: name: Build declaration files command: | pnpm lerna run --scope "@mui/*" build - run: name: Log defect declaration files command: | node scripts/testBuiltTypes.mjs test_browser_legacy: <<: *default-job resource_class: 'medium+' executor: name: code-infra/mui-node-browser playwright-img-version: v1.49.1-noble steps: - checkout - install-deps: react-version: << parameters.react-version >> playwright-version: '1.49.1' - run: name: Tests chromium command: pnpm test:browser --no-isolate --no-file-parallelism - run: name: Tests webkit environment: VITEST_BROWSERS: 'webkit' command: pnpm test:browser --no-isolate --no-file-parallelism - run: name: Tests firefox environment: VITEST_BROWSERS: 'firefox' command: pnpm test:browser --no-isolate --no-file-parallelism - store_test_results: path: test-results test_browser: <<: *default-job resource_class: 'medium+' executor: name: code-infra/mui-node-browser playwright-img-version: v1.56.1-noble steps: - checkout - install-deps: react-version: << parameters.react-version >> - run: name: Tests chromium command: pnpm test:browser --no-isolate --no-file-parallelism --coverage - run: name: Tests webkit environment: VITEST_BROWSERS: 'webkit' command: pnpm test:browser --no-isolate --no-file-parallelism - run: name: Tests firefox environment: VITEST_BROWSERS: 'firefox' command: pnpm test:browser --no-isolate --no-file-parallelism - run: name: Check coverage generated command: | if ! [[ -s coverage/lcov.info ]] then exit 1 fi - code-infra/upload-coverage: key: '<< parameters.react-version >>-browser' - store_test_results: path: test-results test_e2e: <<: *default-job executor: name: code-infra/mui-node-browser playwright-img-version: v1.56.1-noble steps: - checkout - install-deps: react-version: << parameters.react-version >> - run: name: pnpm test:e2e command: pnpm test:e2e test_e2e_website: # NOTE: This workflow runs after successful docs deploy. See /test/e2e-website/README.md#ci <<: *default-job executor: name: code-infra/mui-node-browser playwright-img-version: v1.56.1-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_regressions: <<: *default-job executor: name: code-infra/mui-node-browser playwright-img-version: v1.56.1-noble steps: - checkout - install-deps: react-version: << parameters.react-version >> - run: name: Run visual regression tests command: xvfb-run pnpm test:regressions - run: name: Build packages for fixtures command: pnpm release:build - run: name: Validate type declarations command: pnpm validate-declarations - run: name: Analyze exported typescript command: pnpm test:attw - run: name: Any defect declaration files? command: node scripts/testBuiltTypes.mjs - run: name: test exported typescript command: pnpm --filter @mui-internal/test-module-resolution typescript:all - run: name: Upload screenshots to Argos CI command: pnpm test:argos test_bundling_prepare: <<: *default-job steps: - checkout - install-deps - run: name: Build packages for fixtures command: pnpm lerna run --scope "@mui/*" build - run: name: Pack packages command: pnpm release:pack - persist_to_workspace: root: packed paths: - '*' test_bundling_node_cjs: <<: *default-job working_directory: /tmp/material-ui/test/bundling/fixtures/node-cjs/ steps: - checkout: path: /tmp/material-ui - attach_workspace: at: /tmp/material-ui/packed - install-deps: ignore-workspace: true - run: name: Test fixture command: pnpm start test_bundling_node_esm: <<: *default-job working_directory: /tmp/material-ui/test/bundling/fixtures/node-esm/ steps: - checkout: path: /tmp/material-ui - attach_workspace: at: /tmp/material-ui/packed - install-deps: ignore-workspace: true - run: name: Test fixture # TODO: Known failure command: pnpm start test_bundling_next_webpack4: <<: *default-job executor: name: code-infra/mui-node-browser playwright-img-version: v1.56.1-noble working_directory: /tmp/material-ui/test/bundling/fixtures/next-webpack4/ steps: - checkout: path: /tmp/material-ui - attach_workspace: at: /tmp/material-ui/packed - install-deps: ignore-workspace: true - run: name: Test fixture command: pnpm start test_bundling_next_webpack5: <<: *default-job executor: name: code-infra/mui-node-browser playwright-img-version: v1.56.1-noble working_directory: /tmp/material-ui/test/bundling/fixtures/next-webpack5/ steps: - checkout: path: /tmp/material-ui - attach_workspace: at: /tmp/material-ui/packed - install-deps: ignore-workspace: true - run: name: Test fixture command: pnpm start test_bundling_create_react_app: <<: *default-job executor: name: code-infra/mui-node-browser playwright-img-version: v1.56.1-noble working_directory: /tmp/material-ui/test/bundling/fixtures/create-react-app/ steps: - checkout: path: /tmp/material-ui - attach_workspace: at: /tmp/material-ui/packed - install-deps: ignore-workspace: true - run: name: Test fixture command: pnpm start test_bundling_snowpack: <<: *default-job executor: name: code-infra/mui-node-browser playwright-img-version: v1.56.1-noble working_directory: /tmp/material-ui/test/bundling/fixtures/snowpack/ steps: - checkout: path: /tmp/material-ui - attach_workspace: at: /tmp/material-ui/packed - install-deps: ignore-workspace: true - run: name: Test fixture command: pnpm start test_bundling_vite: <<: *default-job executor: name: code-infra/mui-node-browser playwright-img-version: v1.56.1-noble working_directory: /tmp/material-ui/test/bundling/fixtures/vite/ steps: - checkout: path: /tmp/material-ui - attach_workspace: at: /tmp/material-ui/packed - install-deps: ignore-workspace: true - run: name: Test fixture command: pnpm start test_bundling_esbuild: <<: *default-job docker: - image: mcr.microsoft.com/playwright:v1.56.1-noble working_directory: /tmp/material-ui/test/bundling/fixtures/esbuild/ steps: - checkout: path: /tmp/material-ui - attach_workspace: at: /tmp/material-ui/packed - install-deps: ignore-workspace: true - run: name: Test fixture command: pnpm start test_bundling_gatsby: <<: *default-job executor: name: code-infra/mui-node-browser playwright-img-version: v1.56.1-noble environment: GATSBY_CPU_COUNT: '3' working_directory: /tmp/material-ui/test/bundling/fixtures/gatsby/ steps: - checkout: path: /tmp/material-ui - attach_workspace: at: /tmp/material-ui/packed - install-deps: ignore-workspace: true - run: name: Test fixture command: pnpm start test_bundle_size_monitor: <<: *default-job steps: - checkout - install-deps - run: name: prepare danger on PRs command: pnpm danger ci environment: DANGER_COMMAND: prepareBundleSizeReport - run: name: build @mui packages command: pnpm release:build - aws-cli/setup: aws_access_key_id: $AWS_ACCESS_KEY_ID_ARTIFACTS aws_secret_access_key: $AWS_SECRET_ACCESS_KEY_ARTIFACTS region: ${AWS_REGION_ARTIFACTS} # @TODO: Not using code-infra/upload-size-snapshot since it doesn't support setting concurrency yet - 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 --concurrency 6 # === LEGACY START === # remove once the UI can handle the new format # persist size snapshot on S3 - when: # don't run on PRs condition: not: matches: pattern: '.+' value: '${CIRCLE_PULL_REQUEST}' steps: - aws-s3/copy: arguments: --content-type application/json from: size-snapshot.json to: s3://mui-org-ci/artifacts/$CIRCLE_BRANCH/$CIRCLE_SHA1/ # === LEGACY END === # Keep the artifact storage as a CircleCI artifact - store_artifacts: name: persist size snapshot as pipeline artifact path: size-snapshot.json destination: size-snapshot.json - run: name: Run danger on PRs command: pnpm danger ci --fail-on-errors environment: DANGER_COMMAND: reportBundleSize workflows: version: 2 pipeline: when: equal: [pipeline, << pipeline.parameters.workflow >>] jobs: - test_unit: <<: *default-context - test_lint: <<: *default-context - test_static: <<: *default-context - test_types: <<: *default-context - test_browser: <<: *default-context - test_browser_legacy: <<: *default-context - test_regressions: <<: *default-context - test_e2e: <<: *default-context - test_bundle_size_monitor: <<: *default-context e2e-website: when: equal: [e2e-website, << pipeline.parameters.workflow >>] jobs: - test_e2e_website: <<: *default-context bundling: when: equal: [bundling, << pipeline.parameters.workflow >>] jobs: - test_bundling_prepare: <<: *default-context - test_bundling_node_cjs: <<: *default-context requires: - test_bundling_prepare - test_bundling_node_esm: <<: *default-context requires: - test_bundling_prepare - test_bundling_create_react_app: <<: *default-context requires: - test_bundling_prepare - test_bundling_snowpack: <<: *default-context requires: - test_bundling_prepare - test_bundling_vite: <<: *default-context requires: - test_bundling_prepare - test_bundling_esbuild: <<: *default-context requires: - test_bundling_prepare - test_bundling_gatsby: <<: *default-context requires: - test_bundling_prepare - test_bundling_next_webpack4: <<: *default-context requires: - test_bundling_prepare - test_bundling_next_webpack5: <<: *default-context requires: - test_bundling_prepare # This workflow can be triggered manually on the PR react-17: when: equal: [react-17, << pipeline.parameters.workflow >>] jobs: - test_unit: <<: *default-context react-version: ^17.0.0 name: test_unit-react@17 - test_browser: <<: *default-context react-version: ^17.0.0 name: test_browser-react@17 - test_regressions: <<: *default-context react-version: ^17.0.0 name: test_regressions-react@17 - test_e2e: <<: *default-context react-version: ^17.0.0 name: test_e2e-react@17 # This workflow is identical to react-17, but scheduled # TODO: The v17 tests have deteriorated to the point of no return. Fix for v18 once we # deprecate v17, and reenable this workflow. # react-17-cron: # triggers: # - schedule: # cron: '0 0 * * *' # filters: # branches: # only: # - master # - next # jobs: # - test_unit: # <<: *default-context # react-version: ^17.0.0 # name: test_unit-react@17 # - test_browser: # <<: *default-context # react-version: ^17.0.0 # name: test_browser-react@17 # - test_regressions: # <<: *default-context # react-version: ^17.0.0 # name: test_regressions-react@17 # - test_e2e: # <<: *default-context # react-version: ^17.0.0 # name: test_e2e-react@17 # This workflow can be triggered manually on the PR react-18: when: equal: [react-18, << pipeline.parameters.workflow >>] jobs: - test_unit: <<: *default-context react-version: ^18.0.0 name: test_unit-react@18 - test_browser: <<: *default-context react-version: ^18.0.0 name: test_browser-react@18 - test_regressions: <<: *default-context react-version: ^18.0.0 name: test_regressions-react@18 - test_e2e: <<: *default-context react-version: ^18.0.0 name: test_e2e-react@18 # This workflow is identical to react-18, but scheduled react-18-cron: triggers: - schedule: cron: '0 0 * * *' filters: branches: only: # #target-branch-reference - master - v5.x - v6.x jobs: - test_unit: <<: *default-context react-version: ^18.0.0 name: test_unit-react@18 - test_browser: <<: *default-context react-version: ^18.0.0 name: test_browser-react@18 - test_regressions: <<: *default-context react-version: ^18.0.0 name: test_regressions-react@18 - test_e2e: <<: *default-context react-version: ^18.0.0 name: test_e2e-react@18 # This workflow can be triggered manually on the PR react-next: when: equal: [react-next, << pipeline.parameters.workflow >>] jobs: - test_unit: <<: *default-context react-version: next name: test_unit-react@next - test_browser: <<: *default-context react-version: next name: test_browser-react@next - test_regressions: <<: *default-context react-version: next name: test_regressions-react@next - test_e2e: <<: *default-context react-version: next name: test_e2e-react@next # This workflow is identical to react-next, but scheduled react-next-cron: triggers: - schedule: cron: '0 0 * * *' filters: branches: only: # #target-branch-reference - master - v6.x jobs: - test_unit: <<: *default-context react-version: next name: test_unit-react@next - test_browser: <<: *default-context react-version: next name: test_browser-react@next - test_regressions: <<: *default-context react-version: next name: test_regressions-react@next - test_e2e: <<: *default-context react-version: next name: test_e2e-react@next typescript-next: when: equal: [typescript-next, << pipeline.parameters.workflow >>] jobs: - test_types_next: <<: *default-context typescript-version: next typescript-next-cron: triggers: - schedule: cron: '0 0 * * *' filters: branches: only: # #target-branch-reference - master - v6.x jobs: - test_types_next: <<: *default-context typescript-version: next