Initial testing looks promising - it shaved about one minute off my build times AND made the builds independent of the flakiness troubles we’ve seen recently.
Here is the complete circlei command that we use (copy the parts that apply to you):
commands:
setup:
steps:
- checkout
- restore_cache:
name: Restore Yarn v2 Cache
keys:
- yarn2-cache-{{ checksum ".meteor/versions" }}-{{ checksum "yarn.lock" }}
- yarn2-cache-{{ checksum ".meteor/versions" }}-
- restore_cache:
name: Restore .meteor/local subset
keys:
- meteor-local-{{ checksum ".meteor/versions" }}-{{ .Branch }}-{{ .Revision }}
- meteor-local-{{ checksum ".meteor/versions" }}-{{ .Branch }}-
- meteor-local-{{ checksum ".meteor/versions" }}-
- restore_cache:
name: Restore global meteor installation
keys:
- meteor-global-{{ checksum ".meteor/release" }}-{{ checksum ".meteor/versions" }}
- run:
name: Test if meteor is installed and add symlink (commands copied from meteor install script)
command: |
if [ -d "$HOME/.meteor" ]; then
METEOR_SYMLINK_TARGET="$(readlink "$HOME/.meteor/meteor")"
METEOR_TOOL_DIRECTORY="$(dirname "$METEOR_SYMLINK_TARGET")"
LAUNCHER="$HOME/.meteor/$METEOR_TOOL_DIRECTORY/scripts/admin/launch-meteor"
PREFIX="/usr/local"
echo "Copying meteor launch script from '$LAUNCHER' to '$PREFIX/bin/meteor'"
sudo cp "$LAUNCHER" "$PREFIX/bin/meteor"
which meteor
fi
- run:
name: Install meteor if needed
command: |
export METEOR_VERSION=$(awk '{split($0, a, "@"); print a[2]}' < .meteor/release)
which meteor || timeout 45s bash -c '(curl -s "https://install.meteor.com/?release=${METEOR_VERSION}" | /bin/sh)'
no_output_timeout: 1m # Sometimes meteor does not download, crash early.
- run:
name: Downloading meteor package dependencies specified in .meteor/versions via .meteor/packages
command: |
meteor --prepare-app
- save_cache:
name: Saving meteor global installation
key: meteor-global-{{ checksum ".meteor/release" }}-{{ checksum ".meteor/versions" }}
paths:
- "~/.meteor"
our other save_cache steps look like this:
- save_cache:
name: Saving yarn 2 cache from ./.yarn/cache
key: yarn2-cache-{{ checksum ".meteor/versions" }}-{{ checksum "yarn.lock" }}
paths:
- ./.yarn/cache
- save_cache:
name: Saving meteor cache files
key: meteor-local-{{ checksum ".meteor/versions" }}-{{ .Branch }}-{{ .Revision }}
paths: # https://zodern.me/posts/meteor-local-folder/#caching-in-ci
- "./.meteor/local/isopacks"
- "./.meteor/local/bundler-cache/scanner"
- "./.meteor/local/plugin-cache"