Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
bd9add72
Unverified
Commit
bd9add72
authored
Oct 01, 2020
by
Domas
Committed by
GitHub
Oct 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
toolkit: expose maxWorkers option for plugin build & test tasks (#27724)
parent
22b2d4d4
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
6 deletions
+23
-6
packages/grafana-toolkit/README.md
+1
-0
packages/grafana-toolkit/src/cli/index.ts
+6
-1
packages/grafana-toolkit/src/cli/tasks/plugin.build.ts
+3
-2
packages/grafana-toolkit/src/cli/tasks/plugin.ci.ts
+3
-2
packages/grafana-toolkit/src/cli/tasks/plugin/tests.ts
+10
-1
scripts/webpack/webpack.dev.js
+0
-0
No files found.
packages/grafana-toolkit/README.md
View file @
bd9add72
...
...
@@ -93,6 +93,7 @@ Available options:
-
`-u`
,
`--updateSnapshot`
- Performs snapshots update.
-
`--testNamePattern=<regex>`
- Runs test with names that match provided regex (https://jestjs.io/docs/en/cli#testnamepattern-regex).
-
`--testPathPattern=<regex>`
- Runs test with paths that match provided regex (https://jestjs.io/docs/en/cli#testpathpattern-regex).
-
`--maxWorkers=<num>|<string>`
- Limit number of Jest workers spawned (https://jestjs.io/docs/en/cli#--maxworkersnumstring)
### Build your plugin
...
...
packages/grafana-toolkit/src/cli/index.ts
View file @
bd9add72
...
...
@@ -138,10 +138,11 @@ export const run = (includeInternalScripts = false) => {
program
.
command
(
'plugin:build'
)
.
option
(
'--maxJestWorkers <num>|<string>'
,
'Limit number of Jest workers spawned'
)
.
description
(
'Prepares plugin dist package'
)
.
option
(
'--coverage'
,
'Run code coverage'
,
false
)
.
action
(
async
cmd
=>
{
await
execTask
(
pluginBuildTask
)({
coverage
:
cmd
.
coverage
,
silent
:
true
});
await
execTask
(
pluginBuildTask
)({
coverage
:
cmd
.
coverage
,
silent
:
true
,
maxJestWorkers
:
cmd
.
maxJestWorkers
});
});
program
...
...
@@ -164,6 +165,7 @@ export const run = (includeInternalScripts = false) => {
.
option
(
'--watch'
,
'Run tests in interactive watch mode'
)
.
option
(
'--testPathPattern <regex>'
,
'Run only tests with a path that matches the regex'
)
.
option
(
'--testNamePattern <regex>'
,
'Run only tests with a name that matches the regex'
)
.
option
(
'--maxWorkers <num>|<string>'
,
'Limit number of workers spawned'
)
.
description
(
'Executes plugin tests'
)
.
action
(
async
cmd
=>
{
await
execTask
(
pluginTestTask
)({
...
...
@@ -172,6 +174,7 @@ export const run = (includeInternalScripts = false) => {
watch
:
!!
cmd
.
watch
,
testPathPattern
:
cmd
.
testPathPattern
,
testNamePattern
:
cmd
.
testNamePattern
,
maxWorkers
:
cmd
.
maxWorkers
,
silent
:
true
,
});
});
...
...
@@ -179,10 +182,12 @@ export const run = (includeInternalScripts = false) => {
program
.
command
(
'plugin:ci-build'
)
.
option
(
'--finish'
,
'move all results to the jobs folder'
,
false
)
.
option
(
'--maxJestWorkers <num>|<string>'
,
'Limit number of Jest workers spawned'
)
.
description
(
'Build the plugin, leaving results in /dist and /coverage'
)
.
action
(
async
cmd
=>
{
await
execTask
(
ciBuildPluginTask
)({
finish
:
cmd
.
finish
,
maxJestWorkers
:
cmd
.
maxJestWorkers
,
});
});
...
...
packages/grafana-toolkit/src/cli/tasks/plugin.build.ts
View file @
bd9add72
...
...
@@ -16,6 +16,7 @@ const rimraf = promisify(rimrafCallback);
interface
PluginBuildOptions
{
coverage
:
boolean
;
maxJestWorkers
?:
string
;
}
interface
Fixable
{
...
...
@@ -111,10 +112,10 @@ export const lintPlugin = ({ fix }: Fixable = {}) =>
}
});
export
const
pluginBuildRunner
:
TaskRunner
<
PluginBuildOptions
>
=
async
({
coverage
})
=>
{
export
const
pluginBuildRunner
:
TaskRunner
<
PluginBuildOptions
>
=
async
({
coverage
,
maxJestWorkers
})
=>
{
await
prepare
();
await
lintPlugin
({
fix
:
false
});
await
testPlugin
({
updateSnapshot
:
false
,
coverage
,
watch
:
false
});
await
testPlugin
({
updateSnapshot
:
false
,
coverage
,
maxWorkers
:
maxJestWorkers
,
watch
:
false
});
await
bundlePlugin
({
watch
:
false
,
production
:
true
});
};
...
...
packages/grafana-toolkit/src/cli/tasks/plugin.ci.ts
View file @
bd9add72
...
...
@@ -27,6 +27,7 @@ export interface PluginCIOptions {
finish
?:
boolean
;
upload
?:
boolean
;
signingAdmin
?:
boolean
;
maxJestWorkers
?:
string
;
}
/**
...
...
@@ -40,7 +41,7 @@ export interface PluginCIOptions {
* Anything that should be put into the final zip file should be put in:
* ~/ci/jobs/build_xxx/dist
*/
const
buildPluginRunner
:
TaskRunner
<
PluginCIOptions
>
=
async
({
finish
})
=>
{
const
buildPluginRunner
:
TaskRunner
<
PluginCIOptions
>
=
async
({
finish
,
maxJestWorkers
})
=>
{
const
start
=
Date
.
now
();
if
(
finish
)
{
...
...
@@ -58,7 +59,7 @@ const buildPluginRunner: TaskRunner<PluginCIOptions> = async ({ finish }) => {
writeJobStats
(
start
,
workDir
);
}
else
{
// Do regular build process with coverage
await
pluginBuildRunner
({
coverage
:
true
});
await
pluginBuildRunner
({
coverage
:
true
,
maxJestWorkers
});
}
};
...
...
packages/grafana-toolkit/src/cli/tasks/plugin/tests.ts
View file @
bd9add72
...
...
@@ -8,9 +8,17 @@ export interface PluginTestOptions {
watch
:
boolean
;
testPathPattern
?:
string
;
testNamePattern
?:
string
;
maxWorkers
?:
string
;
}
export
const
testPlugin
=
({
updateSnapshot
,
coverage
,
watch
,
testPathPattern
,
testNamePattern
}:
PluginTestOptions
)
=>
export
const
testPlugin
=
({
updateSnapshot
,
coverage
,
watch
,
testPathPattern
,
testNamePattern
,
maxWorkers
,
}:
PluginTestOptions
)
=>
useSpinner
(
'Running tests'
,
async
()
=>
{
const
testConfig
=
loadJestPluginConfig
();
...
...
@@ -22,6 +30,7 @@ export const testPlugin = ({ updateSnapshot, coverage, watch, testPathPattern, t
testPathPattern
:
testPathPattern
?
[
testPathPattern
]
:
[],
testNamePattern
:
testNamePattern
?
[
testNamePattern
]
:
[],
passWithNoTests
:
true
,
maxWorkers
,
};
// @ts-ignore
...
...
scripts/webpack/webpack.dev.js
View file @
bd9add72
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment