1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-19 18:28:42 +00:00

Split modern and legacy builds

This commit is contained in:
Aidan Timson
2025-12-15 09:56:02 +00:00
parent 81cb483163
commit 5dd74f8523
2 changed files with 26 additions and 7 deletions

View File

@@ -71,9 +71,12 @@ jobs:
- name: Run Tests
run: yarn run test
build:
name: Build frontend
name: Build frontend (${{ matrix.target }})
needs: [lint, test]
runs-on: ubuntu-latest
strategy:
matrix:
target: [modern, legacy]
steps:
- name: Check out files from GitHub
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -88,10 +91,11 @@ jobs:
run: ./node_modules/.bin/gulp build-app
env:
IS_TEST: "true"
BUILD_TARGET: ${{ matrix.target }}
- name: Upload bundle stats
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: frontend-bundle-stats
name: frontend-bundle-stats-${{ matrix.target }}
path: build/stats/*.json
if-no-files-found: error
supervisor:

View File

@@ -17,6 +17,18 @@ import {
createLandingPageConfig,
} from "../rspack.cjs";
const selectBuildTargets = () => {
const target = process.env.BUILD_TARGET?.toLowerCase();
switch (target) {
case "modern":
return [true];
case "legacy":
return [false];
default:
return [true, false];
}
};
const bothBuilds = (createConfigFunc, params) => [
createConfigFunc({ ...params, latestBuild: true }),
createConfigFunc({ ...params, latestBuild: false }),
@@ -112,11 +124,14 @@ gulp.task("rspack-watch-app", () => {
gulp.task("rspack-prod-app", () =>
prodBuild(
bothBuilds(createAppConfig, {
isProdBuild: true,
isStatsBuild: env.isStatsBuild(),
isTestBuild: env.isTestBuild(),
})
selectBuildTargets().map((latestBuild) =>
createAppConfig({
isProdBuild: true,
isStatsBuild: env.isStatsBuild(),
isTestBuild: env.isTestBuild(),
latestBuild,
})
)
)
);