ni / nimble

The NI Nimble Design System
https://nimble.ni.dev
MIT License
29 stars 8 forks source link

Make nimble component lint and test run concurrently #2065

Closed rajsite closed 2 months ago

rajsite commented 2 months ago

Pull Request

🀨 Rationale

Investigating locally I found that by far the nimble-components lint steps (both eslint and prettier) as well as the karma runs (chrome and firefox) are the slowest to run. Updated the concurrent run so that the component commands run in parallel from the start along with synchronous test and lint runs of every other package.

With this change the following commands all start at the same time:

npm run lint (runs lint sequentially one by one for each package in workspace order)
npm run test (runs test sequentially one by one for each package in workspace order)
npm run -w packages/nimble-components prettier (as part of npm run lint-concurrently)
npm run -w packages/nimble-components lint (as part of npm run lint-concurrently)
npm run -w packages/nimble-components test-firefox:verbose (as part of npm run test-concurrently)
npm run -w packages/nimble-components test-chrome:verbose (as part of npm run test-concurrently)

And can see in the following table that the last to finish are the components commands:

--> β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
--> β”‚ name              β”‚ duration β”‚ exit code β”‚ killed β”‚ command                   β”‚
--> β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
--> β”‚ lint-concurrently β”‚ 317,863  β”‚ 0         β”‚ false  β”‚ npm run lint-concurrently β”‚
--> β”‚ test-concurrently β”‚ 311,984  β”‚ 0         β”‚ false  β”‚ npm run test-concurrently β”‚
--> β”‚ test              β”‚ 292,637  β”‚ 0         β”‚ false  β”‚ npm run test              β”‚
--> β”‚ lint              β”‚ 269,971  β”‚ 0         β”‚ false  β”‚ npm run lint              β”‚
--> β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

[lint-concurrently] --> β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
[lint-concurrently] --> β”‚ name     β”‚ duration β”‚ exit code β”‚ killed β”‚ command          β”‚
[lint-concurrently] --> β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
[lint-concurrently] --> β”‚ prettier β”‚ 316,767  β”‚ 0         β”‚ false  β”‚ npm run prettier β”‚
[lint-concurrently] --> β”‚ eslint   β”‚ 93,986   β”‚ 0         β”‚ false  β”‚ npm run eslint   β”‚
[lint-concurrently] --> β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

[test-concurrently] --> β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
[test-concurrently] --> β”‚ name                 β”‚ duration β”‚ exit code β”‚ killed β”‚ command                      β”‚
[test-concurrently] --> β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
[test-concurrently] --> β”‚ test-firefox:verbose β”‚ 310,925  β”‚ 0         β”‚ false  β”‚ npm run test-firefox:verbose β”‚
[test-concurrently] --> β”‚ test-chrome:verbose  β”‚ 303,807  β”‚ 0         β”‚ false  β”‚ npm run test-chrome:verbose  β”‚
[test-concurrently] --> β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

In the end this ends up shaving off only about 2-3 minutes from the CI. I suspect we are probably at the point of diminishing returns for concurrent execution.

πŸ‘©β€πŸ’» Implementation

πŸ§ͺ Testing

Tested locally and CI.

βœ… Checklist