From 87bfbc9bbf059421f2836b04d7187516108a008d Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 9 Jun 2022 10:49:26 +0000 Subject: [PATCH] ci: use RAM disk for Windows tests Windows is IO bound which causes tests to take significantly longer than Linux. With this change we introduce the use of RAM disk on Windows instead of a physical disk to store tests projects files which reduces this overhead. While Circle CI docs mention to use `ImDisk` https://support.circleci.com/hc/en-us/articles/4411520952091-Create-a-windows-RAM-disk, we use a different tool Arsenal Image Mounter `aim_ll` due to following Node.js issue: https://github.com/nodejs/node/issues/6861 The `aim_ll` CLI is based on `ImDisk` and is parameter compatible. From testing a full run of the Windows E2E full test suit goes from ~56min to ~35mins With RAM disk https://app.circleci.com/pipelines/github/angular/angular-cli/23286/workflows/4b1dc425-f7ed-49d6-aeba-b2c503d08756/jobs/309423/parallel-runs/2?filterBy=ALL Without RAM Disk https://app.circleci.com/pipelines/github/angular/angular-cli/23256/workflows/3f551c3c-fbb0-445f-80f9-1801d4adc664/jobs/309312 --- .circleci/config.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 67c2b6cdec64..72c0a1b3660b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,6 +83,25 @@ commands: at: *workspace_location setup_windows: steps: + - run: + # We use Arsenal Image Mounter (AIM) instead of ImDisk because of: https://github.com/nodejs/node/issues/6861 + # Useful resources for AIM: http://reboot.pro/index.php?showtopic=22068 + name: 'Arsenal Image Mounter (RAM Disk)' + command: | + # Download AIM Drivers + Invoke-WebRequest 'https://github.com/ArsenalRecon/Arsenal-Image-Mounter/raw/988930e4b3180ec34661504e6f9906f98943a022/DriverSetup/DriverFiles.zip' -OutFile 'aim_drivers.zip' -UseBasicParsing + Expand-Archive -Path 'aim_drivers.zip' + + # Download AIM CLI + Invoke-WebRequest 'https://github.com/ArsenalRecon/Arsenal-Image-Mounter/raw/988930e4b3180ec34661504e6f9906f98943a022/Command%20line%20applications/aim_ll.zip' -OutFile 'aim_ll.zip' -UseBasicParsing + Expand-Archive -Path 'aim_ll.zip' + + # Install AIM drivers + ./aim_ll/x64/aim_ll.exe --install ./aim_drivers + + # Setup RAM disk mount. Same parameters as ImDisk + # See: https://support.circleci.com/hc/en-us/articles/4411520952091-Create-a-windows-RAM-disk + ./aim_ll/x64/aim_ll.exe -a -s 5G -m X: -p "/fs:ntfs /q /y" - run: nvm install 16.10 - run: nvm use 16.10 - run: npm install -g yarn@1.22.10 @@ -326,10 +345,11 @@ jobs: - run: name: Execute E2E Tests command: | + mkdir X:/ramdisk/e2e-main if (Test-Path env:CIRCLE_PULL_REQUEST) { - node tests\legacy-cli\run_e2e.js "--glob={tests/basic/**,tests/i18n/extract-ivy*.ts,tests/build/profile.ts,tests/test/test-sourcemap.ts,tests/misc/check-postinstalls.ts}" --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX + node tests\legacy-cli\run_e2e.js "--glob={tests/basic/**,tests/i18n/extract-ivy*.ts,tests/build/profile.ts,tests/test/test-sourcemap.ts,tests/misc/check-postinstalls.ts}" --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX --tmpdir=X:/ramdisk/e2e-main } else { - node tests\legacy-cli\run_e2e.js --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX + node tests\legacy-cli\run_e2e.js --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX --tmpdir=X:/ramdisk/e2e-main } - fail_fast