Skip to content

Commit

Permalink
[code infra] pnpm take 2 (#2546)
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot authored Jan 7, 2024
1 parent 16fed82 commit 0140ebd
Show file tree
Hide file tree
Showing 24 changed files with 15,142 additions and 161,169 deletions.
88 changes: 45 additions & 43 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,55 +23,51 @@ commands:
description: 'Set to true if you intend to use any browser (e.g. with playwright).'

steps:
- run:
name: View install environment
command: |
node --version
yarn --version
- restore_cache:
name: Restore yarn cache
name: Restore pnpm Package Cache
keys:
- v11-yarn-{{ checksum "yarn.lock" }}
- run:
name: Set yarn cache folder
command: |
# Keep path in sync with `save_cache` for key "v8-yarn-"
yarn config set cache-folder /tmp/yarn-cache
# Debug information
yarn cache dir
yarn cache list
- pnpm-packages-{{ checksum "pnpm-lock.yaml" }}

- when:
condition: << parameters.browsers >>
steps:
- run:
name: Install pnpm package manager
command: |
corepack enable
corepack prepare pnpm@latest-8 --activate
- run:
name: Prepare playwright hash
command: yarn --json list --pattern playwright > /tmp/playwright_info.json
command: pnpm list --json --filter playwright > /tmp/playwright_info.json
- store_artifacts:
name: Debug playwright hash
path: /tmp/playwright_info.json
- restore_cache:
name: Restore playwright cache
keys:
- v5-playwright-{{ arch }}-{{ checksum "/tmp/playwright_info.json" }}
- run:
name: View install environment
command: |
node --version
pnpm --version
- run:
name: Install js dependencies
command: yarn install
command: pnpm install
- when:
condition: << parameters.browsers >>
steps:
- run:
name: Install playwright browsers
command: yarn playwright install --with-deps
command: pnpm playwright install --with-deps
environment:
PLAYWRIGHT_BROWSERS_PATH: /tmp/pw-browsers

- save_cache:
name: Save yarn cache
key: v11-yarn-{{ checksum "yarn.lock" }}
name: Save pnpm Package Cache
key: pnpm-packages-{{ checksum "pnpm-lock.yaml" }}
paths:
# Keep path in sync with "Set yarn cache folder"
# Can't use environment variables for `save_cache` paths (tested in https://app.circleci.com/pipelines/github/mui/material-ui/37813/workflows/5b1e207f-ac8b-44e7-9ba4-d0f9a01f5c55/jobs/223370)
- /tmp/yarn-cache
- node_modules
- when:
condition: << parameters.browsers >>
steps:
Expand All @@ -94,7 +90,13 @@ jobs:
command: git add -A && git diff --exit-code --staged
- run:
name: Check for duplicated packages
command: yarn deduplicate
command: |
if [[ $(git diff --name-status master | grep pnpm.lock) == "" ]];
then
echo "no changes to dependencies detected, skipping..."
else
pnpm dedupe --check
fi
test_lint:
<<: *defaults
Expand All @@ -103,41 +105,41 @@ jobs:
- install_js
- run:
name: Eslint
command: yarn eslint
command: pnpm eslint
- run:
name: Lint JSON
command: yarn jsonlint
command: pnpm jsonlint
- run:
name: Lint Markdown
command: yarn markdownlint
command: pnpm markdownlint
test_types:
<<: *defaults
steps:
- checkout
- install_js
- run:
name: Check Typescript types
command: yarn check-types
command: pnpm check-types
test_static:
<<: *defaults
steps:
- checkout
- install_js
- run:
name: '`yarn prettier:all` changes committed?'
name: '`pnpm prettier:all` changes committed?'
command: |
yarn prettier:all
yarn check-changes
pnpm prettier:all
pnpm check-changes
- run:
name: '`yarn jsonSchemas` changes committed?'
name: '`pnpm jsonSchemas` changes committed?'
command: |
yarn jsonSchemas
yarn check-changes
pnpm jsonSchemas
pnpm check-changes
- run:
name: '`yarn docs:build:api` changes committed?'
name: '`pnpm docs:build:api` changes committed?'
command: |
yarn docs:build:api
yarn check-changes
pnpm docs:build:api
pnpm check-changes
test_unit:
<<: *defaults
Expand All @@ -148,10 +150,10 @@ jobs:
browsers: false
- run:
name: 'Build packages'
command: yarn release:build
command: pnpm release:build
- run:
name: Tests fake browser
command: yarn test
command: pnpm test

test_integration:
<<: *defaults
Expand All @@ -166,18 +168,18 @@ jobs:
steps:
- checkout
- install_js:
browsers: false
browsers: true
- run:
name: 'Build packages'
command: yarn release:build
command: pnpm release:build
- run:
name: Tests real browser
command: yarn test:integration
command: pnpm test:integration
- store_test_results:
path: test/test-results/junit.xml
- run:
name: Upload screenshots to Argos CI
command: ARGOS_PARALLEL_TOTAL=${CIRCLE_NODE_TOTAL} yarn test:argos
command: ARGOS_PARALLEL_TOTAL=${CIRCLE_NODE_TOTAL} pnpm test:argos
- store_artifacts:
path: test/test-results
destination: playwright-test-results
Expand Down
1 change: 1 addition & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"installCommand": "install:codesandbox",
"buildCommand": "release:build",
"node": "18",
"packages": [
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.next
.yarn
pnpm-lock.yaml
/docs/export
/docs/schemas
/packages/**/dist
Expand Down
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
webpack: {
config: path.join(__dirname, './eslintWebpackResolverConfig.js'),
},
exports: {},
},
},
extends: [
Expand Down Expand Up @@ -73,6 +74,13 @@ module.exports = {
skipShapeProps: true,
},
],
'import/no-unresolved': [
'error',
{
// https://github.com/import-js/eslint-plugin-import/issues/1739
ignore: ['\\.md\\?@mui/markdown$'],
},
],
'import/no-restricted-paths': [
'error',
{
Expand All @@ -95,8 +103,12 @@ module.exports = {
{
files: ['examples/**/*'],
rules: {
// We use it for demonstration purposes
'no-console': 'off',
// Personal preference
'no-underscore-dangle': 'off',
// no node_modules in examples as they are not installed
'import/no-unresolved': 'off',
},
},
{
Expand Down
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Enforce yarn

engine-strict = true
auto-install-peers = true
strict-peer-dependencies=false
Loading

0 comments on commit 0140ebd

Please sign in to comment.