From 8ff5d7117ad7fcd728e95800ad17c03ed165eb44 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Mon, 6 Nov 2023 15:00:33 +0000 Subject: [PATCH] Use fast build for CI assets --- docker/ci/entrypoint.sh | 4 ++-- frontend/angular.json | 16 ++++++++++++++++ frontend/package.json | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/docker/ci/entrypoint.sh b/docker/ci/entrypoint.sh index 9937151f23fa..116c53ea866d 100755 --- a/docker/ci/entrypoint.sh +++ b/docker/ci/entrypoint.sh @@ -57,8 +57,8 @@ reset_dbs() { } precompile_assets() { - execute "JOBS=8 npm install" - execute_quiet "DATABASE_URL=nulldb://db bin/rails openproject:plugins:register_frontend assets:precompile" + execute "JOBS=8 time npm install" + execute_quiet "DATABASE_URL=nulldb://db time bin/rails openproject:plugins:register_frontend assets:precompile" execute_quiet "cp -rp config/frontend_assets.manifest.json public/assets/frontend_assets.manifest.json" # ls -al frontend/.angular/cache/ # find frontend/.angular/cache -type d -exec sh -c 'ls -dt "$1"/*/ | tail -n +2 | xargs rm -r' sh {} \; diff --git a/frontend/angular.json b/frontend/angular.json index 5cba3a9eb068..5c9e5bd2c636 100644 --- a/frontend/angular.json +++ b/frontend/angular.json @@ -114,6 +114,22 @@ "with": "src/environments/environment.prod.ts" } ] + }, + "ci": { + "index": "", + "preserveSymlinks": true, + "optimization": false, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": false, + "buildOptimizer" : false, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ] } } }, diff --git a/frontend/package.json b/frontend/package.json index ee8013e1000f..d552b137aca8 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -180,7 +180,7 @@ }, "scripts": { "analyze": "ng build --configuration production --stats-json && webpack-bundle-analyzer -h 0.0.0.0 -p 9999 ../public/assets/frontend/stats.json", - "build:ci": "node ./node_modules/@angular/cli/bin/ng build --configuration production --named-chunks --source-map=false", + "build:ci": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --configuration ci", "build:fast": "OPENPROJECT_ANGULAR_UGLIFY=false node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --configuration fastprod", "build": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --configuration production --named-chunks --source-map", "build:watch": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --watch --named-chunks",