1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Cache dependencies (#10065)

Dependencies are now cached between builds, using a checksum of the
`yarn.lock` file as the cache key. The `node_modules` directory and the
`.har` file from the install are cached and restored, so that we ensure
the record of the install is always preserved alongside the
dependencies.

The consolidation of the `collect-har-artifact` script was to make it
easier to cache the `.har` file along with the dependencies.
This commit is contained in:
Mark Stacey 2020-12-14 11:46:42 -03:30 committed by GitHub
parent 45b737fca0
commit 5e01602a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View File

@ -125,14 +125,17 @@ jobs:
executor: node-browsers
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: Install deps
command: |
.circleci/scripts/deps-install.sh
- run:
name: Collect yarn install HAR logs
command: |
.circleci/scripts/collect-har-artifact.sh
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules/
- build-artifacts/yarn-install-har/
- persist_to_workspace:
root: .
paths:

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -x
mkdir -p build-artifacts/yarn-install-har
mv ./*.har build-artifacts/yarn-install-har/

View File

@ -7,6 +7,14 @@ set -e
yarn --frozen-lockfile --ignore-scripts --har
# Move HAR file into directory with consistent name so that we can cache it
mkdir -p build-artifacts/yarn-install-har
har_files=(./*.har)
if [[ -f "${har_files[0]}" ]]
then
mv ./*.har build-artifacts/yarn-install-har/
fi
# run each in subshell so directory change does not persist
# scripts can be any of:
# preinstall