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.
feature/default_network_editable
Mark Stacey 4 years ago committed by GitHub
parent 45b737fca0
commit 5e01602a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      .circleci/config.yml
  2. 5
      .circleci/scripts/collect-har-artifact.sh
  3. 8
      .circleci/scripts/deps-install.sh

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

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

@ -7,6 +7,14 @@ set -e
yarn --frozen-lockfile --ignore-scripts --har 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 # run each in subshell so directory change does not persist
# scripts can be any of: # scripts can be any of:
# preinstall # preinstall

Loading…
Cancel
Save