Co-authored-by: spalger <spalger@users.noreply.github.com>
This commit is contained in:
parent
f81cdc3ff7
commit
fedc100d4c
|
@ -7,9 +7,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Path = require('path');
|
const Path = require('path');
|
||||||
const Fs = require('fs');
|
|
||||||
|
|
||||||
const { run, createFailError, CiStatsReporter } = require('@kbn/dev-utils');
|
const { run, createFailError } = require('@kbn/dev-utils');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const Stats = require('webpack/lib/Stats');
|
const Stats = require('webpack/lib/Stats');
|
||||||
const del = require('del');
|
const del = require('del');
|
||||||
|
@ -34,34 +33,6 @@ run(
|
||||||
const took = Math.round((stats.endTime - stats.startTime) / 1000);
|
const took = Math.round((stats.endTime - stats.startTime) / 1000);
|
||||||
|
|
||||||
if (!stats.hasErrors() && !stats.hasWarnings()) {
|
if (!stats.hasErrors() && !stats.hasWarnings()) {
|
||||||
if (!flags.dev) {
|
|
||||||
const reporter = CiStatsReporter.fromEnv(log);
|
|
||||||
|
|
||||||
const metrics = [
|
|
||||||
{
|
|
||||||
group: '@kbn/ui-shared-deps asset size',
|
|
||||||
id: 'kbn-ui-shared-deps.js',
|
|
||||||
value: Fs.statSync(Path.resolve(DIST_DIR, 'kbn-ui-shared-deps.js')).size,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
group: '@kbn/ui-shared-deps asset size',
|
|
||||||
id: 'kbn-ui-shared-deps.@elastic.js',
|
|
||||||
value: Fs.statSync(Path.resolve(DIST_DIR, 'kbn-ui-shared-deps.@elastic.js')).size,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
group: '@kbn/ui-shared-deps asset size',
|
|
||||||
id: 'css',
|
|
||||||
value:
|
|
||||||
Fs.statSync(Path.resolve(DIST_DIR, 'kbn-ui-shared-deps.css')).size +
|
|
||||||
Fs.statSync(Path.resolve(DIST_DIR, 'kbn-ui-shared-deps.v7.light.css')).size,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
log.debug('metrics:', metrics);
|
|
||||||
|
|
||||||
await reporter.metrics(metrics);
|
|
||||||
}
|
|
||||||
|
|
||||||
log.success(`webpack completed in about ${took} seconds`);
|
log.success(`webpack completed in about ${took} seconds`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -101,6 +72,7 @@ run(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info('running webpack');
|
||||||
await onCompilationComplete(
|
await onCompilationComplete(
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
compiler.run((error, stats) => {
|
compiler.run((error, stats) => {
|
||||||
|
|
|
@ -12,6 +12,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const CompressionPlugin = require('compression-webpack-plugin');
|
const CompressionPlugin = require('compression-webpack-plugin');
|
||||||
const { REPO_ROOT } = require('@kbn/utils');
|
const { REPO_ROOT } = require('@kbn/utils');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
const { RawSource } = require('webpack-sources');
|
||||||
|
|
||||||
const UiSharedDeps = require('./index');
|
const UiSharedDeps = require('./index');
|
||||||
|
|
||||||
|
@ -145,6 +146,36 @@ exports.getWebpackConfig = ({ dev = false } = {}) => ({
|
||||||
test: /\.(js|css)$/,
|
test: /\.(js|css)$/,
|
||||||
cache: false,
|
cache: false,
|
||||||
}),
|
}),
|
||||||
|
new (class MetricsPlugin {
|
||||||
|
apply(compiler) {
|
||||||
|
compiler.hooks.emit.tap('MetricsPlugin', (compilation) => {
|
||||||
|
const metrics = [
|
||||||
|
{
|
||||||
|
group: '@kbn/ui-shared-deps asset size',
|
||||||
|
id: 'kbn-ui-shared-deps.js',
|
||||||
|
value: compilation.assets['kbn-ui-shared-deps.js'].size(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: '@kbn/ui-shared-deps asset size',
|
||||||
|
id: 'kbn-ui-shared-deps.@elastic.js',
|
||||||
|
value: compilation.assets['kbn-ui-shared-deps.@elastic.js'].size(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: '@kbn/ui-shared-deps asset size',
|
||||||
|
id: 'css',
|
||||||
|
value:
|
||||||
|
compilation.assets['kbn-ui-shared-deps.css'].size() +
|
||||||
|
compilation.assets['kbn-ui-shared-deps.v7.light.css'].size(),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
compilation.emitAsset(
|
||||||
|
'metrics.json',
|
||||||
|
new RawSource(JSON.stringify(metrics, null, 2))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})(),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,9 @@ echo " -> building and extracting OSS Kibana distributable for use in functional
|
||||||
node scripts/build --debug --oss
|
node scripts/build --debug --oss
|
||||||
|
|
||||||
echo " -> shipping metrics from build to ci-stats"
|
echo " -> shipping metrics from build to ci-stats"
|
||||||
node scripts/ship_ci_stats --metrics target/optimizer_bundle_metrics.json
|
node scripts/ship_ci_stats \
|
||||||
|
--metrics target/optimizer_bundle_metrics.json \
|
||||||
|
--metrics packages/kbn-ui-shared-deps/target/metrics.json
|
||||||
|
|
||||||
linuxBuild="$(find "$KIBANA_DIR/target" -name 'kibana-*-linux-x86_64.tar.gz')"
|
linuxBuild="$(find "$KIBANA_DIR/target" -name 'kibana-*-linux-x86_64.tar.gz')"
|
||||||
installDir="$PARENT_DIR/install/kibana"
|
installDir="$PARENT_DIR/install/kibana"
|
||||||
|
|
|
@ -16,7 +16,9 @@ echo " -> building and extracting OSS Kibana distributable for use in functional
|
||||||
node scripts/build --debug --oss
|
node scripts/build --debug --oss
|
||||||
|
|
||||||
echo " -> shipping metrics from build to ci-stats"
|
echo " -> shipping metrics from build to ci-stats"
|
||||||
node scripts/ship_ci_stats --metrics target/optimizer_bundle_metrics.json
|
node scripts/ship_ci_stats \
|
||||||
|
--metrics target/optimizer_bundle_metrics.json \
|
||||||
|
--metrics packages/kbn-ui-shared-deps/target/metrics.json
|
||||||
|
|
||||||
mkdir -p "$WORKSPACE/kibana-build-oss"
|
mkdir -p "$WORKSPACE/kibana-build-oss"
|
||||||
cp -pR build/oss/kibana-*-SNAPSHOT-linux-x86_64/. $WORKSPACE/kibana-build-oss/
|
cp -pR build/oss/kibana-*-SNAPSHOT-linux-x86_64/. $WORKSPACE/kibana-build-oss/
|
||||||
|
|
|
@ -8,7 +8,9 @@ cd "$KIBANA_DIR"
|
||||||
node scripts/build --debug --no-oss
|
node scripts/build --debug --no-oss
|
||||||
|
|
||||||
echo " -> shipping metrics from build to ci-stats"
|
echo " -> shipping metrics from build to ci-stats"
|
||||||
node scripts/ship_ci_stats --metrics target/optimizer_bundle_metrics.json
|
node scripts/ship_ci_stats \
|
||||||
|
--metrics target/optimizer_bundle_metrics.json \
|
||||||
|
--metrics packages/kbn-ui-shared-deps/target/metrics.json
|
||||||
|
|
||||||
linuxBuild="$(find "$KIBANA_DIR/target" -name 'kibana-*-linux-x86_64.tar.gz')"
|
linuxBuild="$(find "$KIBANA_DIR/target" -name 'kibana-*-linux-x86_64.tar.gz')"
|
||||||
installDir="$KIBANA_DIR/install/kibana"
|
installDir="$KIBANA_DIR/install/kibana"
|
||||||
|
|
|
@ -32,7 +32,9 @@ cd "$KIBANA_DIR"
|
||||||
node scripts/build --debug --no-oss
|
node scripts/build --debug --no-oss
|
||||||
|
|
||||||
echo " -> shipping metrics from build to ci-stats"
|
echo " -> shipping metrics from build to ci-stats"
|
||||||
node scripts/ship_ci_stats --metrics target/optimizer_bundle_metrics.json
|
node scripts/ship_ci_stats \
|
||||||
|
--metrics target/optimizer_bundle_metrics.json \
|
||||||
|
--metrics packages/kbn-ui-shared-deps/target/metrics.json
|
||||||
|
|
||||||
linuxBuild="$(find "$KIBANA_DIR/target" -name 'kibana-*-linux-x86_64.tar.gz')"
|
linuxBuild="$(find "$KIBANA_DIR/target" -name 'kibana-*-linux-x86_64.tar.gz')"
|
||||||
installDir="$KIBANA_DIR/install/kibana"
|
installDir="$KIBANA_DIR/install/kibana"
|
||||||
|
|
Loading…
Reference in a new issue