GitHub Actions cache not cleared after composer.json change #9478
Labels
focus: devops
Release processes, monitoring, automations, dev tools, CI/CD pipeline
type: bug
The issue is a confirmed bug.
Describe the bug
Recently, a change in the autoload definition inside the
composer.json
file caused the E2E and Playwright tests to fail due to an issue with the cached dependencies.Although ideally the
./vendor
directory may not be the best place to cache code, the current implementation of https://github.com/Automattic/jetpack-autoloader will create an optimized autoloader map that gets saved to./vendor/composer
. If we update theautoload
definition but don't refresh the cache, then we may run into issues when loading classes. Example: p1726855117544489-slack-CGGCLBN58To Reproduce
composer.json
composer.json
Actual behavior
The action will use the cached data, this can be verified in the action logs, in the
Setup E2E Environment
section.Expected behavior
If either composer.json or composer.lock changes, the cache should be ignored. This can be verified in the action logs, in the
Setup E2E Environment
section.Additional context
composer-cache
definition can be found here: https://github.com/Automattic/woocommerce-payments/blob/develop/.github/actions/e2e/env-setup/action.yml#L28-L33 The issue could be fixed just by adding the hash of the composer.json file to the cache key.The text was updated successfully, but these errors were encountered: