Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions cache not cleared after composer.json change #9478

Closed
danielmx-dev opened this issue Sep 20, 2024 · 0 comments · Fixed by #9637
Closed

GitHub Actions cache not cleared after composer.json change #9478

danielmx-dev opened this issue Sep 20, 2024 · 0 comments · Fixed by #9637
Assignees
Labels
focus: devops Release processes, monitoring, automations, dev tools, CI/CD pipeline type: bug The issue is a confirmed bug.

Comments

@danielmx-dev
Copy link
Contributor

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 the autoload definition but don't refresh the cache, then we may run into issues when loading classes. Example: p1726855117544489-slack-CGGCLBN58

To Reproduce

  1. Perform an update in composer.json
  2. Run the E2E tests using a feature branch
  3. Perform another update in composer.json
  4. Run the E2E tests once again.

Actual behavior

The action will use the cached data, this can be verified in the action logs, in the Setup E2E Environment section.

Cache restored successfully
Cache restored from key: Linux-vendor-<HASH>

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.

Cache not found for input keys: Linux-vendor-<HASH>

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.

@danielmx-dev danielmx-dev added the type: bug The issue is a confirmed bug. label Sep 20, 2024
@dwainm dwainm added the focus: devops Release processes, monitoring, automations, dev tools, CI/CD pipeline label Sep 23, 2024
@achyuthajoy achyuthajoy self-assigned this Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: devops Release processes, monitoring, automations, dev tools, CI/CD pipeline type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants