Closed vv12131415 closed 4 years ago
You're somehow registering the extension multiple times. If you share the branch where it happen I can take a look.
OskarStark/phpstan-ga
isn't necessary.
I see the job is using the phpstan-ga action:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: PHPStan
uses: "docker://oskarstark/phpstan-ga"
env:
REQUIRE_DEV: true
with:
args: analyse -c .phpstan/phpstan.neon.dist
The problem comes from that - the action also contains the phpstan-symfony extension and on top of that, it uses phpstan/extension-installer. That's unfriendly because if you want to run PHPStan locally, it also dictates your project to use phpstan/extension-installer
so that you don't include extension.neon
and rules.neon
manually. Which is unfortunately because not everyone wants or can use phpstan/extension-installer
, making this action unusable.
I'd recommend you to run PHPStan in GitHub Actions as any other PHP code:
static-analysis:
name: "Static analysis"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.1"
- name: "Install PHP"
uses: "shivammathur/setup-php@2.4.1"
with:
coverage: "none"
php-version: "7.4"
- name: "Cache dependencies"
uses: "actions/cache@v2.1.0"
with:
path: "~/.composer/cache"
key: "php-7.4-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-7.4-composer-"
- name: "Install dependencies"
run: "composer update --prefer-dist --no-interaction --no-progress --no-suggest"
- name: "PHPStan"
run: "vendor/bin/phpstan analyse -c .phpstan/phpstan.neon.dist"
The phpstan-ga action also isn't usable if the versions of PHPStan and extensions in it are different than in your composer.json. I'd say that it's only for basic usage for people that don't have PHPStan installed in their projects or don't use Composer.
@ondrejmirtes thanks a lot!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I'm trying to install this plugin in separate bundle. But when I use it in github actions (https://github.com/OskarStark/phpstan-ga) I see something like this.
When I run it locally it does work perfectly, but not in github actions.
The project is https://github.com/sonata-project/SonataAdminBundle
If I need to move this to https://github.com/OskarStark/phpstan-ga I will.