mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Create webpack bundle stats for Relative CI (#18178)
This commit is contained in:
parent
6c3b748279
commit
79f3759756
12
.github/workflows/ci.yaml
vendored
12
.github/workflows/ci.yaml
vendored
@ -85,6 +85,12 @@ jobs:
|
|||||||
run: ./node_modules/.bin/gulp build-app
|
run: ./node_modules/.bin/gulp build-app
|
||||||
env:
|
env:
|
||||||
IS_TEST: "true"
|
IS_TEST: "true"
|
||||||
|
- name: Upload bundle stats
|
||||||
|
uses: actions/upload-artifact@v3.1.3
|
||||||
|
with:
|
||||||
|
name: frontend-bundle-stats
|
||||||
|
path: build/stats/*.json
|
||||||
|
if-no-files-found: error
|
||||||
supervisor:
|
supervisor:
|
||||||
name: Build supervisor
|
name: Build supervisor
|
||||||
needs: [lint, test]
|
needs: [lint, test]
|
||||||
@ -103,3 +109,9 @@ jobs:
|
|||||||
run: ./node_modules/.bin/gulp build-hassio
|
run: ./node_modules/.bin/gulp build-hassio
|
||||||
env:
|
env:
|
||||||
IS_TEST: "true"
|
IS_TEST: "true"
|
||||||
|
- name: Upload bundle stats
|
||||||
|
uses: actions/upload-artifact@v3.1.3
|
||||||
|
with:
|
||||||
|
name: supervisor-bundle-stats
|
||||||
|
path: build/stats/*.json
|
||||||
|
if-no-files-found: error
|
||||||
|
4
.github/workflows/nightly.yaml
vendored
4
.github/workflows/nightly.yaml
vendored
@ -57,14 +57,14 @@ jobs:
|
|||||||
run: tar -czvf translations.tar.gz translations
|
run: tar -czvf translations.tar.gz translations
|
||||||
|
|
||||||
- name: Upload build artifacts
|
- name: Upload build artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3.1.3
|
||||||
with:
|
with:
|
||||||
name: wheels
|
name: wheels
|
||||||
path: dist/home_assistant_frontend*.whl
|
path: dist/home_assistant_frontend*.whl
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload translations
|
- name: Upload translations
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3.1.3
|
||||||
with:
|
with:
|
||||||
name: translations
|
name: translations
|
||||||
path: translations.tar.gz
|
path: translations.tar.gz
|
||||||
|
28
.github/workflows/relative-ci.yaml
vendored
Normal file
28
.github/workflows/relative-ci.yaml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: RelativeCI
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: [CI]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload:
|
||||||
|
name: Upload stats
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
bundle: [frontend, supervisor]
|
||||||
|
build: [modern, legacy]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Send bundle stats and build information to RelativeCI
|
||||||
|
uses: relative-ci/agent-action@v2.1.8
|
||||||
|
with:
|
||||||
|
key: ${{ secrets[format('RELATIVE_CI_KEY_{1}_{2}', matrix.bundle, matrix.build)] }}
|
||||||
|
token: ${{ github.token }}
|
||||||
|
slug: ${{ format('{1}-{2}', matrix.bundle, matrix.build) }}
|
||||||
|
artifactName: ${{ format('{1}-bundle-stats', matrix.bundle) }}
|
||||||
|
artifactWebpackStatsFile: ${{ format('{1}-{2}.json', matrix.bundle, matrix.build) }}
|
@ -149,7 +149,7 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
|
|||||||
sourceMaps: !isTestBuild,
|
sourceMaps: !isTestBuild,
|
||||||
});
|
});
|
||||||
|
|
||||||
const nameSuffix = (latestBuild) => (latestBuild ? "-latest" : "-es5");
|
const nameSuffix = (latestBuild) => (latestBuild ? "-modern" : "-legacy");
|
||||||
|
|
||||||
const outputPath = (outputRoot, latestBuild) =>
|
const outputPath = (outputRoot, latestBuild) =>
|
||||||
path.resolve(outputRoot, latestBuild ? "frontend_latest" : "frontend_es5");
|
path.resolve(outputRoot, latestBuild ? "frontend_latest" : "frontend_es5");
|
||||||
@ -183,7 +183,7 @@ const publicPath = (latestBuild, root = "") =>
|
|||||||
module.exports.config = {
|
module.exports.config = {
|
||||||
app({ isProdBuild, latestBuild, isStatsBuild, isTestBuild, isWDS }) {
|
app({ isProdBuild, latestBuild, isStatsBuild, isTestBuild, isWDS }) {
|
||||||
return {
|
return {
|
||||||
name: "app" + nameSuffix(latestBuild),
|
name: "frontend" + nameSuffix(latestBuild),
|
||||||
entry: {
|
entry: {
|
||||||
service_worker: "./src/entrypoints/service_worker.ts",
|
service_worker: "./src/entrypoints/service_worker.ts",
|
||||||
app: "./src/entrypoints/app.ts",
|
app: "./src/entrypoints/app.ts",
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
const { existsSync } = require("fs");
|
const { existsSync } = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
|
const { StatsWriterPlugin } = require("webpack-stats-plugin");
|
||||||
|
const filterStats = require("@bundle-stats/plugin-webpack-filter").default;
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
|
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
|
||||||
const log = require("fancy-log");
|
const log = require("fancy-log");
|
||||||
@ -152,6 +154,15 @@ const createWebpackConfig = ({
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
!isProdBuild && new LogStartCompilePlugin(),
|
!isProdBuild && new LogStartCompilePlugin(),
|
||||||
|
isProdBuild &&
|
||||||
|
new StatsWriterPlugin({
|
||||||
|
filename: path.relative(
|
||||||
|
outputPath,
|
||||||
|
path.join(paths.build_dir, "stats", `${name}.json`)
|
||||||
|
),
|
||||||
|
stats: { assets: true, chunks: true, modules: true },
|
||||||
|
transform: (stats) => JSON.stringify(filterStats(stats)),
|
||||||
|
}),
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [".ts", ".js", ".json"],
|
extensions: [".ts", ".js", ".json"],
|
||||||
|
@ -159,6 +159,7 @@
|
|||||||
"@babel/plugin-transform-runtime": "7.22.15",
|
"@babel/plugin-transform-runtime": "7.22.15",
|
||||||
"@babel/preset-env": "7.22.20",
|
"@babel/preset-env": "7.22.20",
|
||||||
"@babel/preset-typescript": "7.23.0",
|
"@babel/preset-typescript": "7.23.0",
|
||||||
|
"@bundle-stats/plugin-webpack-filter": "4.7.6",
|
||||||
"@koa/cors": "4.0.0",
|
"@koa/cors": "4.0.0",
|
||||||
"@lokalise/node-api": "12.0.0",
|
"@lokalise/node-api": "12.0.0",
|
||||||
"@octokit/auth-oauth-device": "6.0.1",
|
"@octokit/auth-oauth-device": "6.0.1",
|
||||||
@ -248,6 +249,7 @@
|
|||||||
"webpack-cli": "5.1.4",
|
"webpack-cli": "5.1.4",
|
||||||
"webpack-dev-server": "4.15.1",
|
"webpack-dev-server": "4.15.1",
|
||||||
"webpack-manifest-plugin": "5.0.0",
|
"webpack-manifest-plugin": "5.0.0",
|
||||||
|
"webpack-stats-plugin": "1.1.3",
|
||||||
"webpackbar": "5.0.2",
|
"webpackbar": "5.0.2",
|
||||||
"workbox-build": "7.0.0"
|
"workbox-build": "7.0.0"
|
||||||
},
|
},
|
||||||
|
18
yarn.lock
18
yarn.lock
@ -1437,6 +1437,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@bundle-stats/plugin-webpack-filter@npm:4.7.6":
|
||||||
|
version: 4.7.6
|
||||||
|
resolution: "@bundle-stats/plugin-webpack-filter@npm:4.7.6"
|
||||||
|
peerDependencies:
|
||||||
|
core-js: ^3.0.0
|
||||||
|
checksum: a7bb72f6222dc8ec06c923d93772c2569885fbeb127d5a7df3e0c88b4f23b7ec7d92ae5525b5ede6a81b00416c8d3a18a00d7637990f51afc1fc0a284d275426
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@codemirror/autocomplete@npm:6.9.2":
|
"@codemirror/autocomplete@npm:6.9.2":
|
||||||
version: 6.9.2
|
version: 6.9.2
|
||||||
resolution: "@codemirror/autocomplete@npm:6.9.2"
|
resolution: "@codemirror/autocomplete@npm:6.9.2"
|
||||||
@ -9634,6 +9643,7 @@ __metadata:
|
|||||||
"@babel/preset-typescript": 7.23.0
|
"@babel/preset-typescript": 7.23.0
|
||||||
"@babel/runtime": 7.23.1
|
"@babel/runtime": 7.23.1
|
||||||
"@braintree/sanitize-url": 6.0.4
|
"@braintree/sanitize-url": 6.0.4
|
||||||
|
"@bundle-stats/plugin-webpack-filter": 4.7.6
|
||||||
"@codemirror/autocomplete": 6.9.2
|
"@codemirror/autocomplete": 6.9.2
|
||||||
"@codemirror/commands": 6.3.0
|
"@codemirror/commands": 6.3.0
|
||||||
"@codemirror/language": 6.9.1
|
"@codemirror/language": 6.9.1
|
||||||
@ -9840,6 +9850,7 @@ __metadata:
|
|||||||
webpack-cli: 5.1.4
|
webpack-cli: 5.1.4
|
||||||
webpack-dev-server: 4.15.1
|
webpack-dev-server: 4.15.1
|
||||||
webpack-manifest-plugin: 5.0.0
|
webpack-manifest-plugin: 5.0.0
|
||||||
|
webpack-stats-plugin: 1.1.3
|
||||||
webpackbar: 5.0.2
|
webpackbar: 5.0.2
|
||||||
weekstart: 2.0.0
|
weekstart: 2.0.0
|
||||||
workbox-build: 7.0.0
|
workbox-build: 7.0.0
|
||||||
@ -16335,6 +16346,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"webpack-stats-plugin@npm:1.1.3":
|
||||||
|
version: 1.1.3
|
||||||
|
resolution: "webpack-stats-plugin@npm:1.1.3"
|
||||||
|
checksum: 9a71d329c5d55e33105abfe4c72d715a0a6ce4ab8da6faa2bc5a65953915d656cdf3c420b3fc0628b0d9859cc59c09e49f731645746739e417da531130a7a9a8
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"webpack@npm:5.88.2":
|
"webpack@npm:5.88.2":
|
||||||
version: 5.88.2
|
version: 5.88.2
|
||||||
resolution: "webpack@npm:5.88.2"
|
resolution: "webpack@npm:5.88.2"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user