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

Fixes GitHub Action workflow to tests on multiple Laravel versions. #6801

Merged
merged 7 commits into from
Sep 29, 2022
Merged

Fixes GitHub Action workflow to tests on multiple Laravel versions. #6801

merged 7 commits into from
Sep 29, 2022

Conversation

crynobone
Copy link
Contributor

Here's some tips about testing multiple versions:

  1. You should add laravel/framework or one of the illuminate/* component to require section (already done).
  2. The workflow then should only install the opposite requirements to require-dev. If you require the framework you should install one of the components using 7.x, 8.x or 9.x constraint, or the opposite.

@jasonvarga
Copy link
Member

The workflow then should only install the opposite requirements to require-dev.

What do you mean by the opposite? If we require laravel/framework then the opposite is illuminate/contracts?

Could you explain why?

@crynobone
Copy link
Contributor Author

crynobone commented Sep 29, 2022

Because Composer on Windows not smart enough to understand the build process that this repository was trying to do.

Because windows build can't properly parse caret ^ constraints: https://twitter.com/driesvints/status/1575396427240509440

You should inspect this build https://github.com/statamic/cms/actions/runs/3146066349/jobs/5114089006

Prefer stable should load the latest stable but it's installing Laravel Framework 9.0.0, which force to install an old version of Testbench but allows latest Testbench Core.

@jasonvarga
Copy link
Member

Wow, thanks.

Dries tweeted that today. Did you guys only discover this problem today too?

@crynobone
Copy link
Contributor Author

i personally have been avoiding caret for years but never found a solid reason to promote it for GitHub Actions until now.

Due to the current issue, I submitted few PR to Laravel packages to avoid using caret and Dries pinpoint the root cause. TIL too (was previously assumed Composer on Windows has a gotcha).

@jasonvarga
Copy link
Member

I see why you are requiring illuminate/contracts instead of framework. It allows the framework constraint in composer.json to control the lowest version. That's something I struggled with, and why I had those extra framework lines in the workflow.

Very clever trick. Thank you!

It would be awesome if this was explained on the testbench docs. I'm sure other people would find it useful to know the best way to test their packages across multiple versions/OSs on GitHub actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants