diff --git a/.circleci/config.yml b/.circleci/config.yml index 64e698a6db..636d00b6f7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,7 +103,6 @@ jobs: docker: - image: eaadtbs/ib-ci-build:1.4 <<: *dockerhub_auth - resource_class: medium+ working_directory: "~/InfoBase" steps: - checkout: @@ -151,7 +150,7 @@ jobs: - prod-build-{{ .Branch }}-{{ .Revision }} - run: command: | - [ -f "client/$BUILD_DIR/InfoBase/app/app-a11y-en.min.js" ] || (cd client && ./deploy_scripts/build_all.sh -m 4096 -c "none") + [ -f "client/$BUILD_DIR/InfoBase/app/app-a11y-en.min.js" ] || (cd client && ./deploy_scripts/build_all.sh -m 900 -c "none") - save_cache: paths: - client/build diff --git a/client/deploy_scripts/build_all.sh b/client/deploy_scripts/build_all.sh index 111ac42ec2..23eb7f40d2 100755 --- a/client/deploy_scripts/build_all.sh +++ b/client/deploy_scripts/build_all.sh @@ -2,8 +2,7 @@ set -e # will exit if any command has non-zero exit value concurrency="full" -max_old_space_size=1024 - +max_old_space_size=2048 while getopts "c:m:" opt; do case ${opt} in c) concurrency=$OPTARG;; @@ -16,89 +15,75 @@ if [[ ! $concurrency =~ ^(full|half|none)$ ]]; then exit 1 fi +# the prod no-watch scripts in client/package.json will use MAX_OLD_SPACE_SIZE if it exists +export MAX_OLD_SPACE_SIZE=$max_old_space_size + [ -e $BUILD_DIR/InfoBase ] && rm -r $BUILD_DIR/InfoBase # clean up build dir npm run IB_base -# When exiting, either from finishing, being killed, or throwing an error, kill the spinner and dump the captured build process output to terminal -function print_captured_output { - kill -9 $spinner_pid - - [ -f $scratch/ib_prod_en_build_out ] && cat $scratch/ib_prod_en_build_out - [ -f $scratch/ib_prod_en_build_err ] && cat $scratch/ib_prod_en_build_err - - [ -f $scratch/ib_prod_fr_build_out ] && cat $scratch/ib_prod_fr_build_out - [ -f $scratch/ib_prod_fr_build_err ] && cat $scratch/ib_prod_fr_build_err - - [ -f $scratch/a11y_prod_en_build_out ] && cat $scratch/a11y_prod_en_build_out - [ -f $scratch/a11y_prod_en_build_err ] && cat $scratch/a11y_prod_en_build_err - - [ -f $scratch/a11y_prod_fr_build_out ] && cat $scratch/a11y_prod_fr_build_out - [ -f $scratch/a11y_prod_fr_build_err ] && cat $scratch/a11y_prod_fr_build_err -} - +if [ $concurrency == "none" ]; then + # Just running all builds one at a time, no backgrounding or output redirection + npm run IB_prod_no_watch_en + + npm run IB_prod_no_watch_fr + + npm run a11y_prod_no_watch_en -scratch=$(mktemp -d -t captured_build_output.XXXXXXXXXX) -if [ $concurrency == "full" ]; then + npm run a11y_prod_no_watch_fr +else # Run standard and a11y builds in parallel as background processes, store thieir stdout and stderr in temp files and hold on to their pids, # clean up and dump output on exit - trap print_captured_output EXIT echo "" - echo "Running prod builds in background, full concurrency..." + echo "Running prod builds in background, $concurrency concurrency..." spinner_pid=$(sh ../scripts/spinner.sh) - npm run IB_prod_no_watch_en -- --max_old_space_size=$max_old_space_size > $scratch/ib_prod_en_build_out 2> $scratch/ib_prod_en_build_err & - ib_prod_en_pid=$! + # When exiting, either from finishing, being killed, or throwing an error, kill the spinner and dump the captured build process output to terminal + scratch=$(mktemp -d -t captured_build_output.XXXXXXXXXX) + function print_captured_output { + kill -9 $spinner_pid - npm run IB_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size > $scratch/ib_prod_fr_build_out 2> $scratch/ib_prod_fr_build_err & - ib_prod_fr_pid=$! + [ -f $scratch/ib_prod_en_build_out ] && cat $scratch/ib_prod_en_build_out3 + [ -f $scratch/ib_prod_en_build_err ] && cat $scratch/ib_prod_en_build_err - npm run a11y_prod_no_watch_en -- --max_old_space_size=$max_old_space_size > $scratch/a11y_prod_en_build_out 2> $scratch/a11y_prod_en_build_err & - a11y_prod_en_pid=$! + [ -f $scratch/ib_prod_fr_build_out ] && cat $scratch/ib_prod_fr_build_out + [ -f $scratch/ib_prod_fr_build_err ] && cat $scratch/ib_prod_fr_build_err - npm run a11y_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size > $scratch/a11y_prod_fr_build_out 2> $scratch/a11y_prod_fr_build_err & - a11y_prod_fr_pid=$! - - wait $ib_prod_en_pid - wait $ib_prod_fr_pid - wait $a11y_prod_en_pid - wait $a11y_prod_fr_pid -elif [ $concurrency == "half" ]; then - # Same as "full" concurrency, but only run two builds at a time + [ -f $scratch/a11y_prod_en_build_out ] && cat $scratch/a11y_prod_en_build_out + [ -f $scratch/a11y_prod_en_build_err ] && cat $scratch/a11y_prod_en_build_err + + [ -f $scratch/a11y_prod_fr_build_out ] && cat $scratch/a11y_prod_fr_build_out + [ -f $scratch/a11y_prod_fr_build_err ] && cat $scratch/a11y_prod_fr_build_err + } trap print_captured_output EXIT - echo "" - echo "Running prod builds in background, half concurrency..." - spinner_pid=$(sh ../scripts/spinner.sh) - - npm run IB_prod_no_watch_en -- --max_old_space_size=$max_old_space_size > $scratch/ib_prod_en_build_out 2> $scratch/ib_prod_en_build_err & + npm run IB_prod_no_watch_en > $scratch/ib_prod_en_build_out 2> $scratch/ib_prod_en_build_err & ib_prod_en_pid=$! - npm run IB_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size > $scratch/ib_prod_fr_build_out 2> $scratch/ib_prod_fr_build_err & + npm run IB_prod_no_watch_fr > $scratch/ib_prod_fr_build_out 2> $scratch/ib_prod_fr_build_err & ib_prod_fr_pid=$! - - wait $ib_prod_en_pid - wait $ib_prod_fr_pid - npm run a11y_prod_no_watch_en -- --max_old_space_size=$max_old_space_size > $scratch/a11y_prod_en_build_out 2> $scratch/a11y_prod_en_build_err & + if [ $concurrency == "half" ]; then + wait $ib_prod_en_pid + wait $ib_prod_fr_pid + fi + + npm run a11y_prod_no_watch_en > $scratch/a11y_prod_en_build_out 2> $scratch/a11y_prod_en_build_err & a11y_prod_en_pid=$! - npm run a11y_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size > $scratch/a11y_prod_fr_build_out 2> $scratch/a11y_prod_fr_build_err & + npm run a11y_prod_no_watch_fr > $scratch/a11y_prod_fr_build_out 2> $scratch/a11y_prod_fr_build_err & a11y_prod_fr_pid=$! - - wait $a11y_prod_en_pid - wait $a11y_prod_fr_pid -elif [ $concurrency == "none" ]; then - # Just running all builds one at a time, no backgrounding or output redirection - - npm run IB_prod_no_watch_en -- --max_old_space_size=$max_old_space_size - - npm run IB_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size - - npm run a11y_prod_no_watch_en -- --max_old_space_size=$max_old_space_size - npm run a11y_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size + if [ $concurrency == "half" ]; then + wait $a11y_prod_en_pid + wait $a11y_prod_fr_pid + else + wait $ib_prod_en_pid + wait $ib_prod_fr_pid + wait $a11y_prod_en_pid + wait $a11y_prod_fr_pid + fi fi exit \ No newline at end of file diff --git a/client/package.json b/client/package.json index 37188abe11..79a48b4889 100644 --- a/client/package.json +++ b/client/package.json @@ -12,8 +12,8 @@ "IB_dev": "node build_code/webpack_starter.js EN FR TARGET-IE11 main_client", "IB_prod": "node build_code/webpack_starter.js EN FR TARGET-IE11 PROD main_client", "IB_prod_no_watch": "node build_code/webpack_starter.js EN FR TARGET-IE11 PROD NO-WATCH main_client", - "IB_prod_no_watch_en": "node build_code/webpack_starter.js EN TARGET-IE11 PROD NO-WATCH main_client", - "IB_prod_no_watch_fr": "node build_code/webpack_starter.js FR TARGET-IE11 PROD NO-WATCH main_client", + "IB_prod_no_watch_en": "node --max-old-space-size=${MAX_OLD_SPACE_SIZE:-2048} build_code/webpack_starter.js EN TARGET-IE11 PROD NO-WATCH main_client", + "IB_prod_no_watch_fr": "node --max-old-space-size=${MAX_OLD_SPACE_SIZE:-2048} build_code/webpack_starter.js FR TARGET-IE11 PROD NO-WATCH main_client", "IB_prod_stats": "node build_code/webpack_starter.js EN TARGET-IE11 PROD STATS main_client", "IB_prod_stats_save_baseline": "node build_code/webpack_starter.js EN TARGET-IE11 PROD STATS STATS-BASELINE main_client", "IB_prod_stats_no_compare": "node build_code/webpack_starter.js EN TARGET-IE11 PROD STATS NO-COMPARE main_client", @@ -22,8 +22,8 @@ "a11y_dev": "node build_code/webpack_starter.js EN FR TARGET-IE11 a11y_client", "a11y_prod": "node build_code/webpack_starter.js EN FR TARGET-IE11 PROD a11y_client", "a11y_prod_no_watch": "node build_code/webpack_starter.js EN FR TARGET-IE11 PROD NO-WATCH a11y_client", - "a11y_prod_no_watch_en": "node build_code/webpack_starter.js EN TARGET-IE11 PROD NO-WATCH a11y_client", - "a11y_prod_no_watch_fr": "node build_code/webpack_starter.js FR TARGET-IE11 PROD NO-WATCH a11y_client", + "a11y_prod_no_watch_en": "node --max-old-space-size=${MAX_OLD_SPACE_SIZE:-2048} build_code/webpack_starter.js EN TARGET-IE11 PROD NO-WATCH a11y_client", + "a11y_prod_no_watch_fr": "node --max-old-space-size=${MAX_OLD_SPACE_SIZE:-2048} build_code/webpack_starter.js FR TARGET-IE11 PROD NO-WATCH a11y_client", "route_load_tests": "node browser-tests/route-load-tests.js --browser chrome", "ci_route_load_tests": "node browser-tests/route-load-tests.js --browser chromium --sandbox false --concurrency 8", "ci_serve": "http-server -s -a 127.0.0.1",