mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
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:
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/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"
|
||||
Reference in New Issue
Block a user