Currently we’re setting up a workflow with one job being the installing of composer dependencies. It’s a pretty basic job which restores the vendor folder from cache, installs dependencies (only if restoring from cache fails) and then saves again to cache. I use the checksum of both composer.json and composer.lock as caching key. So far so good.
However when running composer with the --optimized-autoloader flag it seems to hardcode paths in the autoload files which are stored in vendor/composer. We’re now running into the issue where we removed a PHP class but it still being referenced in the autoload files restored from the cache (because the composer.json/lock didn’t change it obviously didn’t reinstall dependencies).
As it is not possible to create checksum keys based on files which are not in my VCS repository (i.e. the autoload files), is there some way to use CircleCI’s caching mechanism for composer? Reverting to having to install composer dependencies in every job would kind of suck