Skip to content

Commit

Permalink
[infra] Replace lerna run with top-level wireit scripts (#3098)
Browse files Browse the repository at this point in the history
Replaces all `lerna run` scripts with `wireit` scripts.

### Benefits

- Increased parallelism during build/test.

- We'll now only be using Lerna for bootstrapping, so we can replace it with npm workspaces in a followup PR.

- It's now easier to figure out which packages failed, because the log statements will say e.g. `[packages/lit-html:build] Failed ...` instead of `[build] Failed`.

### Enumerated packages

This does include some long enumerations of packages. Once we have google/wireit#23, we could replace this with something like:

```json
  "wireit": {
    "test": {
      "dependencies": [
        {
          "script": "test",
          "packages": "workspaces"
        }
      ]
    }
  }
```

However, we currently exclude some packages, e.g. we don't run `lit-html`/`lit-element` package tests, because they are subsumed by the `tests` package. Previously we excluded them with Lerna `--ignore` flags. Now they are just not in the list.

Maybe once we have the above Wireit feature, we could add `test:ci` scripts, which would not be present in the case of packages whose tests we don't want to run in CI.

### Also

- Fixes an incorrect virtualizer output path.

- Fixes an output issue where the lit-html `build:version-stability-test` config was emitting `polyfill-support.js`, which collided with the same file emitted by `build:rollup`.

- Bumps the wtr tests finished timeout. Running both the SSR and main browser tests in parallel makes tests take longer. I guess because of resource starvation.

- Added some additional dependencies to the new `testing` package.

Fixes #2724
Part of #3093
  • Loading branch information
aomarks committed Jun 29, 2022
1 parent 75e90d3 commit d705af4
Show file tree
Hide file tree
Showing 8 changed files with 602 additions and 445 deletions.
2 changes: 2 additions & 0 deletions .changeset/twenty-wasps-agree.md
@@ -0,0 +1,2 @@
---
---
5 changes: 1 addition & 4 deletions .github/workflows/tests.yml
Expand Up @@ -89,10 +89,7 @@ jobs:
- name: Lerna bootstrap
run: npm run bootstrap

- name: Build
run: npm run build -- --scope @lit-labs/analyzer --scope @lit-labs/gen-utils --scope @lit-labs/gen-wrapper-angular --scope @lit-labs/gen-wrapper-vue --scope @lit-labs/gen-wrapper-react --scope @lit-labs/cli

- name: Test
env:
RUN_BROWSER_TESTS: false
run: npm run test -- --scope @lit-labs/analyzer --scope @lit-labs/gen-utils --scope @lit-labs/gen-wrapper-angular --scope @lit-labs/gen-wrapper-vue --scope @lit-labs/gen-wrapper-react --scope @lit-labs/cli
run: npm run test:windows
892 changes: 460 additions & 432 deletions package-lock.json

Large diffs are not rendered by default.

132 changes: 128 additions & 4 deletions package.json
Expand Up @@ -9,23 +9,147 @@
"scripts": {
"benchmarks": "cd packages/benchmarks && npm run benchmarks",
"bootstrap": "lerna bootstrap --ci --ignore @lit/lit-starter-* && lerna bootstrap --ci --scope @lit/lit-starter-* --concurrency=1",
"build": "lerna run build",
"build:ts": "lerna run build:ts",
"clean": "lerna run clean",
"build": "wireit",
"build:ts": "wireit",
"build:lit-starter-ts": "wireit",
"format": "npm run format:eslint && npm run format:prettier",
"format:eslint": "eslint \"**/*.{js,ts}\" --fix",
"format:prettier": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --write",
"ignore-sync": "ignore-sync .",
"lint": "eslint \"**/*.{js,ts}\"",
"nuke": "rm -rf node_modules && npm install && lerna exec 'rm -rf node_modules' && lerna bootstrap && npm run clean",
"upgrade": "rm -rf node_modules package-lock.json && npm install && lerna exec 'rm -rf node_modules package-lock.json' && lerna bootstrap && npm run clean",
"test": "lerna run test --ignore '{lit,lit-html,lit-element,@lit/reactive-element,@lit-labs/context,@lit-labs/motion,@lit-labs/observers,@lit-labs/react,@lit-labs/router,@lit-labs/scoped-registry-mixin,@lit-labs/task}' --concurrency 1 --stream ",
"test": "wireit",
"test:lit-starter-js": "wireit",
"test:lit-starter-ts": "wireit",
"test:windows": "wireit",
"prepare": "husky install",
"changeset": "changeset",
"version": "npm run changeset version && npm run update-version-vars && lerna bootstrap -- --package-lock-only",
"update-version-vars": "node scripts/update-version-variables.js",
"release": "npm run bootstrap && npm run build && npm run changeset publish"
},
"wireit": {
"build": {
"dependencies": [
"./packages/benchmarks:build",
"./packages/internal-scripts:build",
"./packages/lit:build",
"./packages/lit-element:build",
"./packages/lit-html:build",
"./packages/lit-starter-js:build",
"build:lit-starter-ts",
"./packages/localize:build",
"./packages/localize-tools:build",
"./packages/reactive-element:build",
"./packages/tests:build",
"./packages/ts-transformers:build",
"./packages/labs/analyzer:build",
"./packages/labs/cli:build",
"./packages/labs/context:build",
"./packages/labs/eleventy-plugin-lit:build",
"./packages/labs/gen-utils:build",
"./packages/labs/gen-wrapper-angular:build",
"./packages/labs/gen-wrapper-react:build",
"./packages/labs/gen-wrapper-vue:build",
"./packages/labs/motion:build",
"./packages/labs/observers:build",
"./packages/labs/react:build",
"./packages/labs/router:build",
"./packages/labs/scoped-registry-mixin:build",
"./packages/labs/ssr:build",
"./packages/labs/ssr-client:build",
"./packages/labs/task:build",
"./packages/labs/testing:build",
"./packages/labs/virtualizer:build",
"./packages/labs/vue-utils:build",
"./packages/labs/test-projects/test-element-a:build",
"./packages/localize/examples/runtime-js:build",
"./packages/localize/examples/runtime-ts:build",
"./packages/localize/examples/transform-js:build",
"./packages/localize/examples/transform-ts:build"
]
},
"build:ts": {
"dependencies": [
"./packages/internal-scripts:build:ts",
"./packages/lit:build:ts",
"./packages/lit-element:build:ts",
"./packages/lit-html:build:ts",
"./packages/localize:build:ts",
"./packages/localize-tools:build:ts",
"./packages/reactive-element:build:ts",
"./packages/ts-transformers:build:ts",
"./packages/labs/context:build:ts",
"./packages/labs/eleventy-plugin-lit:build:ts",
"./packages/labs/motion:build:ts",
"./packages/labs/observers:build:ts",
"./packages/labs/react:build:ts",
"./packages/labs/router:build:ts",
"./packages/labs/scoped-registry-mixin:build:ts",
"./packages/labs/ssr:build:ts",
"./packages/labs/ssr-client:build:ts",
"./packages/labs/task:build:ts",
"./packages/labs/testing:build:ts",
"./packages/labs/virtualizer:build:ts",
"./packages/labs/vue-utils:build:ts"
]
},
"build:lit-starter-ts": {
"#comment": [
"The starter kits are special because they're templates for other",
"repos, so we don't want it to use wireit directly. Instead, this",
"hack integrates it into the overall build with correct ordering."
],
"command": "cd packages/lit-starter-ts && npm run build",
"dependencies": [
"./packages/lit:build:ts:types"
]
},
"test": {
"dependencies": [
"test:lit-starter-js",
"test:lit-starter-ts",
"./packages/localize:test",
"./packages/localize-tools:test",
"./packages/tests:test",
"./packages/ts-transformers:test",
"./packages/labs/analyzer:test",
"./packages/labs/cli:test",
"./packages/labs/eleventy-plugin-lit:test",
"./packages/labs/gen-utils:test",
"./packages/labs/gen-wrapper-angular:test",
"./packages/labs/gen-wrapper-react:test",
"./packages/labs/gen-wrapper-vue:test",
"./packages/labs/ssr:test",
"./packages/labs/testing:test",
"./packages/labs/virtualizer:test"
]
},
"test:lit-starter-js": {
"command": "cd packages/lit-starter-js && npm test",
"dependencies": [
"./packages/lit:build"
]
},
"test:lit-starter-ts": {
"command": "cd packages/lit-starter-ts && npm test",
"dependencies": [
"build:lit-starter-ts",
"./packages/lit:build"
]
},
"test:windows": {
"dependencies": [
"./packages/labs/analyzer:test",
"./packages/labs/cli:test",
"./packages/labs/gen-utils:test",
"./packages/labs/gen-wrapper-angular:test",
"./packages/labs/gen-wrapper-react:test",
"./packages/labs/gen-wrapper-vue:test"
]
}
},
"devDependencies": {
"@babel/eslint-parser": "^7.17.0",
"@changesets/cli": "^2.16.0",
Expand Down
11 changes: 8 additions & 3 deletions packages/labs/testing/package.json
Expand Up @@ -23,14 +23,17 @@
"wireit": {
"build": {
"dependencies": [
"build:ts"
"build:ts",
"../../lit:build",
"../ssr-client:build"
]
},
"build:ts": {
"command": "tsc --build --pretty",
"clean": "if-file-deleted",
"dependencies": [
"../../lit:build:ts:types"
"../../lit:build:ts:types",
"../ssr:build:ts"
],
"files": [
"src/**/*.ts",
Expand All @@ -50,7 +53,9 @@
"dependencies": [
"build"
],
"files": [],
"files": [
"web-test-runner.config.js"
],
"output": []
}
},
Expand Down
1 change: 0 additions & 1 deletion packages/labs/virtualizer/package.json
Expand Up @@ -66,7 +66,6 @@
".tsbuildinfo",
"layouts/**/*.{js,d.ts,d.ts.map}",
"polyfillLoaders/**/*.{js,d.ts,d.ts.map}",
"polyfills/**/*.{js,d.ts,d.ts.map}",
"test/**/*.{js,d.ts,d.ts.map}",
"!test/screenshot/**",
"lit-virtualizer.{js,d.ts,d.ts.map}",
Expand Down
2 changes: 2 additions & 0 deletions packages/lit-html/rollup-version-stability-test.config.js
Expand Up @@ -10,4 +10,6 @@ export default defaultConfig({
outputDir: './version-stability-build/',
testPropertyPrefix: 'VERSION_TEST_',
copyHtmlTests: false,
// Don't emit polyfill-support.js from this test
bundled: [],
});
2 changes: 1 addition & 1 deletion packages/tests/src/web-test-runner.config.ts
Expand Up @@ -226,7 +226,7 @@ const config: TestRunnerConfig = {
// enough so that blocked tests have time to wait for all previous test files
// to run to completion.
testsStartTimeout: 60000 * 10, // default 120000
testsFinishTimeout: 120000, // default 20000
testsFinishTimeout: 600000, // default 20000
testFramework: {
// https://mochajs.org/api/mocha
config: {
Expand Down

0 comments on commit d705af4

Please sign in to comment.