Skip to content

Speedup danger-review by caching node_modules instead of .yarn-cache

Rémy Coutable requested to merge speedup-danger-review into master

What does this MR do?

This should speed up the danger-review job from 5.4 minutes: https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=8100542&udv=1005715

Before

 $ yarn install --frozen-lockfile --cache-folder .yarn-cache --prefer-offline
 yarn install v1.21.1
 [1/5] Validating package.json...
 [2/5] Resolving packages...
 warning Resolution field "ts-jest@24.0.0" is incompatible with requested version "ts-jest@^23.10.5"
 [3/5] Fetching packages...
 warning sha.js@2.4.10: Invalid bin entry for "sha.js" (in "sha.js").
 info fsevents@1.2.9: The platform "linux" is incompatible with this module.
 info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
 info fsevents@2.0.7: The platform "linux" is incompatible with this module.
 info "fsevents@2.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
 [4/5] Linking dependencies...
 warning " > monaco-editor-webpack-plugin@1.7.0" has incorrect peer dependency "monaco-editor@^0.15.1".
 warning "@gitlab/eslint-plugin > eslint-plugin-jest > @typescript-eslint/experimental-utils > @typescript-eslint/typescript-estree > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
 warning " > eslint-import-resolver-jest@2.1.2" has unmet peer dependency "eslint-plugin-import@>=1.4.0".
 warning " > eslint-import-resolver-webpack@0.12.1" has unmet peer dependency "eslint-plugin-import@>=1.4.0".
 [5/5] Building fresh packages...
 $ node ./scripts/frontend/postinstall.js
 success Dependency postinstall check passed.
 Done in 71.66s.

After

  • Restoring cache is 33 seconds faster.
  • Installing NPM packages is 1 minute 22 seconds faster:
 $ retry yarn install --frozen-lockfile
 yarn install v1.21.1
 [1/5] Validating package.json...
 [2/5] Resolving packages...
 warning Resolution field "ts-jest@24.0.0" is incompatible with requested version "ts-jest@^23.10.5"
 success Already up-to-date.
 $ node ./scripts/frontend/postinstall.js
 success Dependency postinstall check passed.
 Done in 1.29s.
  • Saving cache is 33 seconds slower

Net time saved: 33 + 82 - 33 = 82 seconds = 1 minute 22 seconds.

Edited by Rémy Coutable

Merge request reports