💚(ci) fix performance issue of test job

Currently the test job seems to hit the maximum CPU resource available.
In order to prevent that we try to run tests on several workers.
This commit is contained in:
jbpenrath
2023-06-30 10:52:34 +02:00
committed by Jean-Baptiste PENRATH
parent d05e38520b
commit 6aca0a3d85
8 changed files with 33 additions and 23 deletions

View File

@@ -93,13 +93,17 @@ jobs:
test:
docker:
- image: cimg/node:16.18
parallelism: 4
resource_class: large
working_directory: ~/cunningham
steps:
- *checkout_cunningham
- *restore_node_modules
- attach_workspace:
at: ~/cunningham
- run:
name: Run test suites over all workspaces
command: yarn test
command: yarn test-ci
# ---- Internationalization ----
crowdin-upload:
@@ -222,4 +226,4 @@ workflows:
requires:
- build
- lint
- test
- test

View File

@@ -10,6 +10,7 @@
"build": "turbo run build",
"dev": "turbo run dev --parallel",
"test": "turbo run test",
"test-ci": "turbo run test-ci",
"lint": "turbo run lint",
"deploy": "turbo run deploy",
"format": "prettier --write \"**/*.{ts,tsx,md}\""

View File

@@ -33,6 +33,7 @@
"build-theme": "cunningham -o src -g css,ts,js",
"preview": "vite preview",
"test": "FORCE_COLOR=1 vitest run",
"test-ci": "VITEST_MIN_THREADS=1 VITEST_MAX_THREADS=3 FORCE_COLOR=1 vitest run --shard $(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL",
"test-watch": "vitest",
"coverage": "vitest run --coverage",
"storybook": "storybook dev -p 6006",

View File

@@ -25,11 +25,12 @@
"scripts": {
"lint": "eslint . 'src/**/*.{ts,tsx}'",
"dev": "nodemon --watch 'src/bin' --ext '*' --exec 'yarn build'",
"build-bin": "cd src/bin && tsc -p tsconfig.json && tsc-alias && chmod +x ../../dist/bin/Main.js",
"build-bin": "cd src/bin && rm -rf ../../dist/bin && tsc -p tsconfig.build.json && tsc-alias && chmod +x ../../dist/bin/Main.js",
"build-lib": "cp dist/cunningham-tokens.ts src/lib && cd src/lib && tsc -p tsconfig.json",
"build": "yarn build-bin && yarn build-default-theme && yarn build-lib && cd ../.. && ln -sf ../../packages/tokens/dist/bin/Main.js node_modules/.bin/cunningham",
"build-default-theme": "./dist/bin/Main.js -o dist -s html -g scss,css,js,ts --utility-classes",
"test": "FORCE_COLOR=1 jest --runInBand --verbose src"
"test": "FORCE_COLOR=1 jest --runInBand --verbose src",
"test-ci": "FORCE_COLOR=1 jest -w 3 --shard $(($CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL src"
},
"dependencies": {
"chalk": "4.1.2",

View File

@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"exclude": [
"./__mocks__",
"./tests",
"**/*.spec.ts",
]
}

View File

@@ -1,7 +1,7 @@
{
"extends": "@openfun/typescript-configs/node.json",
"include": [
"**/*",
"**/*"
],
"compilerOptions": {
"baseUrl": "./",
@@ -9,6 +9,6 @@
"*": ["*"]
},
"resolveJsonModule": true,
"outDir": "../../dist/bin",
}
}
"outDir": "../../dist/bin"
},
}

View File

@@ -27,6 +27,15 @@
"test/**/*.tsx"
]
},
"test-ci": {
"outputs": [],
"inputs": [
"src/**/*.tsx",
"src/**/*.ts",
"test/**/*.ts",
"test/**/*.tsx"
]
},
"deploy": {
"dependsOn": [
"build",

View File

@@ -4654,7 +4654,7 @@
resolved "https://registry.yarnpkg.com/@tanstack/table-core/-/table-core-8.9.3.tgz#991da6b015f6200fdc841c48048bee5e197f6a46"
integrity sha512-NpHZBoHTfqyJk0m/s/+CSuAiwtebhYK90mDuf5eylTvgViNOujiaOaxNDxJkQQAsVvHWZftUGAx1EfO1rkKtLg==
"@testing-library/dom@9.3.1":
"@testing-library/dom@^9.0.0", "@testing-library/dom@9.3.1":
version "9.3.1"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-9.3.1.tgz#8094f560e9389fb973fe957af41bf766937a9ee9"
integrity sha512-0DGPd9AR3+iDTjGoMpxIkAsUihHZ3Ai6CneU6bRRrffXMgzCdlNk43jTrD2/5LT6CBb3MWTP8v510JzYtahD2w==
@@ -4668,20 +4668,6 @@
lz-string "^1.5.0"
pretty-format "^27.0.2"
"@testing-library/dom@^9.0.0":
version "9.3.0"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-9.3.0.tgz#ed8ce10aa5e05eb6eaf0635b5b8975d889f66075"
integrity sha512-Dffe68pGwI6WlLRYR2I0piIkyole9cSBH5jGQKCGMRpHW5RHCqAUaqc2Kv0tUyd4dU4DLPKhJIjyKOnjv4tuUw==
dependencies:
"@babel/code-frame" "^7.10.4"
"@babel/runtime" "^7.12.5"
"@types/aria-query" "^5.0.1"
aria-query "^5.0.0"
chalk "^4.1.0"
dom-accessibility-api "^0.5.9"
lz-string "^1.5.0"
pretty-format "^27.0.2"
"@testing-library/jest-dom@5.16.5":
version "5.16.5"
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.16.5.tgz#3912846af19a29b2dbf32a6ae9c31ef52580074e"