Repository navigation
Warm the composer cache for reference solutions at build time - #339
Merged
Merged
Conversation
ReferencePackages installs each reference solution's packages once, keeping or writing its composer.lock and filling the shared cache. The verify then installs them with COMPOSER_DISABLE_NETWORK, so it never downloads. composer.lock is now copied with the reference solution.
A workshop can run without anything calling ReferencePackages, eg. from a clone, so the verify must still work then.
composer install/update warms them, and a verify downloads on a cache miss.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Third task of #336, changed from installing packages into the image to warming the composer cache.
ReferencePackages::warm(): for each reference solution with acomposer.jsonit runscomposer installin the sandbox. That keeps a committedcomposer.lockor writes one, and fills the shared cache. It then deletes the solution'svendor/, so an old one can't stop the cache filling.PrepareSolutionListenerstill installs on each verify. It tries offline first (COMPOSER_DISABLE_NETWORK=1, about 0.4s for dependency-heaven), and downloads only if the cache misses. So a workshop run from a clone, where nothing calledwarm(), still works.DirectorySolutionno longer excludescomposer.lock, so the lock is copied with the reference solution.warm-cachecommand. Workshops run it from composerpost-install-cmdandpost-update-cmd, so a clone,create-projector workshop-manager install warms the cache.Tested from an empty cache: learn-you-php and php8-appreciate pass on Docker and host, and php8-appreciate's committed lock is unchanged.
phpschool.io calls
warm()inbuild-runtime-imagesonce this is merged, because composer doesn't run a dependency's scripts. learn-you-php and php8-appreciate add the composer scripts once this is merged.Also tried a fresh clone of learn-you-php with an empty composer home and no
warm(): dependency-heaven verifies on the host.