extdn / github-actions-m2

137 stars 46 forks source link

Fix composer version #96

Closed norgeindian closed 1 year ago

norgeindian commented 1 year ago

According to magento-phpstan/action.yml, the default version should be 2.

jissereitsma commented 1 year ago

I'm in favor of quick fixing here. Most developers should be using composer 2 anyway, because we live in modern times. If people still want to fall back to composer 1, this can be overridden anyway.

jissereitsma commented 1 year ago

First issue already, PHP 7.3 and older Magento versions will not work with composer 2: https://github.com/extdn/github-actions-m2/commit/6eca205972c00543408e36514b18bcdd7ce1b2c7

norgeindian commented 1 year ago

@jissereitsma , something is still wrong:

image

Do you see any reason for this strange behaviour?

jissereitsma commented 1 year ago

@norgeindian For which PHP version is this? The current entrypoint.sh shows a message "Setup extension source folder within Magento root" (which is shown in your screenshot too), but right before that it should give a message "Using composer 2" (which in your case is not showing). So it would be my guess, that the wrong version is used or that the right Docker version is never built.

Currently you are using extdn/magento-phpstan-action:latest but this was not changed in 3 years, since the images were refactored for different PHP versions. The image version you should be looking for is extdn/magento-phpstan-action:7.4-latest or similar.

norgeindian commented 1 year ago

@jissereitsma , thanks for the fast reply. This is my phpstan.yml:

name: ExtDN M2 PHPStan
on: [push, pull_request]

jobs:
  phpstan:
    name: M2 PHPStan
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: extdn/github-actions-m2/magento-phpstan@master
        with:
          composer_name: customgento/module-mass-update-tier-prices-m2
          composer_version: 2

I more or less copied it from the readme. So am I doing something wrong here?

jissereitsma commented 1 year ago

yes, if you change uses: extdn/github-actions-m2/magento-phpstan@master to uses: extdn/github-actions-m2/magento-phpstan/8.1@master like here: https://github.com/extdn/github-actions-m2/blob/master/examples/extdn-phpstan.yml

norgeindian commented 1 year ago

@jissereitsma , thanks a lot. That seems to work now. Would you agree, that we should adapt that in the README, so it's more obvious to everyone how it works? Then I will be happy to provide a PR.

jissereitsma commented 1 year ago

Good point. I've update the README already :)