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

Testing against different versions of Sylius #104

Open
pamil opened this issue Jun 4, 2018 · 7 comments
Open

Testing against different versions of Sylius #104

pamil opened this issue Jun 4, 2018 · 7 comments

Comments

@pamil
Copy link
Contributor

pamil commented Jun 4, 2018

No description provided.

@pamil pamil added this to the v1.2.0 milestone Jun 4, 2018
@stefandoorn
Copy link
Contributor

Example: https://github.com/stefandoorn/sitemap-plugin/blob/master/.travis.yml

@stefandoorn
Copy link
Contributor

Also include a way to test <1.3 against PHP 7.1 while >= 1.3 it cannot use PHP 7.1..

Or: Sylius/Sylius#9838

@igormukhingmailcom
Copy link

This is an example how I've implemented that. (After that it was wiped out as far as finally we decided we don't need to test 1.2, so you will not find this at master):

Setono/SyliusCatalogPromotionPlugin@f7f85a5

The important thing here is to exclude incompatible sets (1.3+7.1) as far as it will make travis fail everytime.

@igormukhingmailcom
Copy link

Clean example:

# .travis.yml

env:
    matrix:
        - SYMFONY_VERSION="3.4.*" SYLIUS_VERSION="1.2.*"
        - SYMFONY_VERSION="4.1.*" SYLIUS_VERSION="1.2.*"
        - SYMFONY_VERSION="3.4.*" SYLIUS_VERSION="1.3.*"
        - SYMFONY_VERSION="4.1.*" SYLIUS_VERSION="1.3.*"
 matrix:
    exclude:
      # Sylius 1.3 won't work on PHP 7.1
      - php: 7.1
        env: SYMFONY_VERSION="3.4.*" SYLIUS_VERSION="1.3.*"
      - php: 7.1
        env: SYMFONY_VERSION="4.1.*" SYLIUS_VERSION="1.3.*"

# ...

 install:
    - composer require "symfony/symfony:${SYMFONY_VERSION}" --no-interaction --no-update
    - composer require "sylius/sylius:${SYLIUS_VERSION}" --no-interaction --no-update

@pamil pamil changed the title Add testing against different versions of Sylius Testing against different versions of Sylius Jun 3, 2020
@pamil pamil removed this from the v1.2.0 milestone Jun 3, 2020
@4c0n
Copy link
Contributor

4c0n commented Jun 3, 2020

Although I am not a big fan of git submodules, so far it works for testing on multiple Sylius versions. I haven't gone through the extent of adding multiple Symfony versions and PHP versions, but that's not the hard part and has been done many times over.

https://github.com/4c0n/SyliusBarcodeSearchPlugin/blob/master/.travis.yml

Another option, at least for public repos, is to use flex to literally install the plugin in a new Sylius standard installation and then somehow run the tests. As this works for public repos only I haven't bothered, because I have to maintain plugins in private repos as well and don't like doing things differently there.

Hopes this helps getting this very old topic of the ground!

@4c0n
Copy link
Contributor

4c0n commented Jun 3, 2020

The difference with the solution above is that this method allows you to keep multiple versions of the preconfigured test application on separate branches of a separate git repo. This will also allow you to run automated UI tests using Behat and Mink against different Sylius versions.

To be quite honest, I feel that a better solution would be to have a composer installer plugin for Sylius plugins, that allows for streamlining the plugin installation and updating. In a lot of plugins what we're doing is overriding templates for example, flex is okay at copying them for you, but what if you made changes of your own in the project? The only way you can know what to do right now is see if the docs tell you to do something and try to figure it out, every time you update for all plugins (but who is going to do that? right..) It's also not feasible to bump a major version every time a template is changed.

The installer plugin or "Sylius plugin installer composer plugin" to be clear :P could perhaps notify that changes have to be made to overridden templates and show a diff among other tasks yet to be determined.

Subsequently the "Sylius plugin installer composer plugin" can then be used to install the plugin in a clean Sylius instance on the CI, providing clean room testing of the plugins installation/update process at the same time.

@4c0n
Copy link
Contributor

4c0n commented Jun 3, 2020

@pamil You were asking about custom config in the submodule?

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

No branches or pull requests

4 participants