Files
github-actions-magento2/cache-magento/compute-stamp-paths.sh
T
Damien Retzinger 8d00f8149a 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.
2026-05-09 15:47:53 -04:00

19 lines
763 B
Bash
Executable File

#!/usr/bin/env bash
# Args: working_directory exclude_from_stamp
# working_directory: absolute path (caller is responsible for realpath resolution)
# exclude_from_stamp: newline-separated list of composer package names to exclude
WORKING_DIR="$1"
EXCLUDE_FROM_STAMP="${2:-}"
VENDOR="${WORKING_DIR}/vendor"
PATHS="${VENDOR}/**"$'\n'"!${VENDOR}/**/"$'\n'"!${VENDOR}/magento/magento2-base"$'\n'"!${VENDOR}/magento/magento2-base/**"$'\n'"!${VENDOR}/mage-os/magento2-base"$'\n'"!${VENDOR}/mage-os/magento2-base/**"
while IFS= read -r pkg; do
pkg="${pkg#"${pkg%%[![:space:]]*}"}"
pkg="${pkg%"${pkg##*[![:space:]]}"}"
[[ -z "$pkg" ]] && continue
PATHS="${PATHS}"$'\n'"!${VENDOR}/${pkg}"$'\n'"!${VENDOR}/${pkg}/**"
done <<< "$EXCLUDE_FROM_STAMP"
echo "$PATHS"