feat(cache-magento): add stamp caching for vendor/ directory (#245)

Adds an opt-in `stamp` mode that caches the extracted `vendor/`
directory in addition to the Composer download cache. On a warm
hit, `composer install` is effectively a no-op and shaves 2–5
minutes off a full Magento install.
This commit is contained in:
Damien Retzinger
2026-05-09 15:42:40 -04:00
parent 2d7238de14
commit 8d00f8149a
6 changed files with 260 additions and 39 deletions
+14 -2
View File
@@ -1,8 +1,20 @@
#!/usr/bin/env bash
# Args: composer_cache_key os php_version composer_version
# Args: composer_cache_key os php_version composer_version project lock_hash
COMPOSER_CACHE_KEY="$1"
OS="$2"
PHP_VERSION="$3"
COMPOSER_VERSION="$4"
PROJECT="$5"
LOCK_HASH="${6:-}"
echo "download-key=composer | v5.8 | ${OS} | ${COMPOSER_CACHE_KEY} | ${COMPOSER_VERSION} | ${PHP_VERSION}"
MODE="extension"
SUFFIX=""
if [ -n "$PROJECT" ]; then
MODE="store"
[ -n "$LOCK_HASH" ] && SUFFIX=" | $LOCK_HASH"
fi
BASE="composer | v5.8 | ${OS} | ${MODE} | ${COMPOSER_CACHE_KEY} | ${COMPOSER_VERSION} | ${PHP_VERSION}"
echo "download-key=${BASE}${SUFFIX}"
echo "download-restore-key=${BASE}"
echo "stamp-key=composer | stamp | v5.8 | ${OS} | ${MODE} | ${COMPOSER_CACHE_KEY} | ${COMPOSER_VERSION} | ${PHP_VERSION}${SUFFIX}"