Skip to content

Commit

Permalink
Add src/i18n-cache to CI caches
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio committed Mar 13, 2024
1 parent 1bcf648 commit d7eacdc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .buildkite/commands/install-node-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
PLATFORM=$(uname -s)
ARCHITECTURE=$(uname -m)
NODE_VERSION=$(node --version)

PACKAGE_HASH=$(hash_file package-lock.json)
GUTENBERG_PACKAGE_HASH=$(hash_file gutenberg/package-lock.json)
JETPACK_PACKAGE_HASH=$(hash_file jetpack/pnpm-lock.yaml)
CACHEKEY="$BUILDKITE_PIPELINE_SLUG-npm-$PLATFORM-$ARCHITECTURE-node$NODE_VERSION-$PACKAGE_HASH-$GUTENBERG_PACKAGE_HASH"

JETPACK_PACKAGE_HASH=$(hash_file jetpack/pnpm-lock.yaml)
PNPM_CACHEKEY="$BUILDKITE_PIPELINE_SLUG-pnpm-$PLATFORM-$ARCHITECTURE-node$NODE_VERSION-$JETPACK_PACKAGE_HASH"

I18N_CACHEKEY="$BUILDKITE_PIPELINE_SLUG-i18n-$PLATFORM-$ARCHITECTURE-node$NODE_VERSION-$PACKAGE_HASH-$GUTENBERG_PACKAGE_HASH"

echo "--- :npm: Restore cache if present"
restore_cache "$CACHEKEY"
restore_cache "$PNPM_CACHEKEY"
restore_cache "$I18N_CACHEKEY"

echo "--- :npm: Install Node dependencies"
npm ci --unsafe-perm --prefer-offline --no-audit --no-progress "$@"
Expand All @@ -21,6 +26,7 @@ echo "--- :npm: Save cache if necessary"
# Those get regenerated by npm ci as per Node reccomendations.
# What we are caching is the root npm folder, which stores pacakge downloads so they are available if the package.json resolution demands them.
save_cache "$HOME/.npm" "$CACHEKEY"
save_cache src/i18n-cache "$I18N_CACHEKEY"

# If we attempted to save the pnpm cache when npm run with '--prefix gutenberg', the command might fail.
# That's because the Jetpack submodule alone uses pnpm.
Expand Down

0 comments on commit d7eacdc

Please sign in to comment.