Skip to content

Commit

Permalink
chore: move phpstan to its own action
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoray committed Jan 21, 2025
1 parent 5e3d724 commit 58e0f16
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PHPStan

on:
push:
paths:
- "**.php"
- "phpstan.neon.dist"
- ".github/workflows/phpstan.yml"

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
coverage: none

- name: Install composer dependencies
uses: ramsey/composer-install@v3

- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
20 changes: 8 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,26 @@ jobs:
name: PHP - ${{ matrix.php }}
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip
tools: composer:v2
coverage: none
- name: Remove pint dependency to prevent unnecessary dependency collisions

- name: Setup problem matchers
run: |
composer remove --dev laravel/pint
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-progress
- name: Remove PHP CS Fixer dependency to prevent unnecessary dependency collisions
run: |
composer remove --dev friendsofphp/php-cs-fixer
- name: PHPStan
run: |
composer require "phpstan/phpstan" --dev
vendor/bin/phpstan analyse --no-progress
- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
run: vendor/bin/paratest --verbose
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
},
"require-dev": {
"brianium/paratest": "^6.11",
"friendsofphp/php-cs-fixer": "^3.66",
"guzzlehttp/guzzle": "^7.6",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^9.6",
Expand All @@ -82,7 +81,6 @@
}
},
"scripts": {
"test": "./vendor/bin/phpunit tests",
"format": "./vendor/bin/pint"
"test": "./vendor/bin/paratest"
}
}

0 comments on commit 58e0f16

Please sign in to comment.