Skip to content

Commit

Permalink
chore: test:lib task-caching w/ Nx (#5116)
Browse files Browse the repository at this point in the history
* adding quick caching test

* reverting workflow change

* updating pr yml to test nx speed

* fixing yml on property

* fixing yml on property

* fixing target name

* upping to running4 in parallel

* upping to running 5 in parallel

* upping to running 6 in parallel

* upping to running 7 in parallel

* upping to running 8 in parallel

* upping to running 9 in parallel

* upping to running 10 in parallel

* opting for --parallel=5

* cleaning up nx.json

* revert touching of ci.yml file

* reverting on property of pr.yml file

* updating root pacakge.json test:lib command

* fixing frozen lockfile error in ci

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
  • Loading branch information
ZackDeRose and TkDodo committed Mar 14, 2023
1 parent b8b0562 commit 19a8e98
Show file tree
Hide file tree
Showing 4 changed files with 417 additions and 48 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: pr
on: [pull_request]

jobs:
test:
name: 'Test'
Expand All @@ -15,7 +16,7 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- run: pnpm run test:lib
- run: pnpm nx run-many --target=test:lib --parallel=5
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
lint:
Expand Down
39 changes: 39 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["test:lib"]
}
}
},
"defaultBase": "main",
"namedInputs": {
"globalBuildAffectingConfig": [
"{workspaceRoot}/babel.config.js",
"{workspaceRoot}/rollup.config.js",
"{workspaceRoot}/rollup.config.ts",
"{workspaceRoot}/tsconfig.json",
"{workspaceRoot}/tsconfig.base.json"
],
"globalNonBuildAffectingConfig": [
"{workspaceRoot}/.eslintrc",
"{workspaceRoot}/jest-preset.js"
],
"default": ["{projectRoot}/**/*", "globalBuildAffectingConfig", "globalNonBuildAffectingConfig"],
"public": [
"default",
"!{workspaceRoot}/.eslintrc",
"!{workspaceRoot}/jest-preset.js",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/.eslintrc",
"!{projectRoot}/jest.config.js"
]
},
"targetDefaults": {
"test:lib": {
"outputs": ["{projectRoot}/coverage"],
"inputs": ["default", "^public"]
}
}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test:react:17": "pnpm --filter \"./packages/react-*\" run test:lib",
"test:eslint": "pnpm --filter \"./packages/**\" run test:eslint",
"test:format": "pnpm run prettier --check",
"test:lib": "pnpm --filter \"./packages/**\" run test:lib",
"test:lib": "nx run-many --target=test:lib --parallel=5",
"test:lib:dev": "pnpm --filter \"./packages/**\" run test:lib:dev",
"test:build": "pnpm run build && bundlewatch && pnpm run validatePackages",
"test:types": "pnpm --filter \"./packages/**\" run test:types",
Expand Down Expand Up @@ -91,7 +91,8 @@
"ts-jest": "^27.1.1",
"ts-node": "^10.7.0",
"typescript": "^4.7.4",
"vue": "^3.2.33"
"vue": "^3.2.33",
"nx": "^15.8.6"
},
"bundlewatch": {
"files": [
Expand Down
Loading

0 comments on commit 19a8e98

Please sign in to comment.