Skip to content

Commit

Permalink
Change phpstan action on pull request, add a phpstan lvl 6
Browse files Browse the repository at this point in the history
  • Loading branch information
JoMessina committed Mar 6, 2023
1 parent e85477e commit 9374af7
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 47 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/phpstan-5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ jobs:
phpstan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: '**/vendor'
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- uses: php-actions/composer@v5
- uses: php-actions/composer@v6
with:
args: --prefer-dist
php_version: 8.0
php_version: '8.2'
- name: PHPStan
uses: php-actions/phpstan@v2
uses: php-actions/phpstan@v3
with:
path: src/
level: 4
php_version: 8.0
level: 5
php_version: '8.2'
23 changes: 23 additions & 0 deletions .github/workflows/phpstan-6.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: PHPStan level 6
on: push
jobs:
phpstan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: '**/vendor'
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- uses: php-actions/composer@v6
with:
args: --prefer-dist
php_version: '8.2'
- name: PHPStan
uses: php-actions/phpstan@v3
with:
path: src/
level: 6
php_version: '8.2'
12 changes: 6 additions & 6 deletions .github/workflows/phpstan-7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ jobs:
phpstan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: '**/vendor'
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- uses: php-actions/composer@v5
- uses: php-actions/composer@v6
with:
args: --prefer-dist
php_version: 8.0
php_version: '8.2'
- name: PHPStan
uses: php-actions/phpstan@v2
uses: php-actions/phpstan@v3
with:
path: src/
level: 7
php_version: 8.0
php_version: '8.2'
12 changes: 6 additions & 6 deletions .github/workflows/phpstan-8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ jobs:
phpstan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: '**/vendor'
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- uses: php-actions/composer@v5
- uses: php-actions/composer@v6
with:
args: --prefer-dist
php_version: 8.0
php_version: '8.2'
- name: PHPStan
uses: php-actions/phpstan@v2
uses: php-actions/phpstan@v3
with:
path: src/
level: 8
php_version: 8.0
php_version: '8.2'
14 changes: 7 additions & 7 deletions .github/workflows/quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ jobs:
cs-fixer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Cs-Fixer
run: |
wget -q https://cs.symfony.com/download/php-cs-fixer-v2.phar -O php-cs-fixer
wget -q https://cs.symfony.com/download/php-cs-fixer-v3.phar -O php-cs-fixer
chmod a+x php-cs-fixer
PHP_CS_FIXER_IGNORE_ENV=true ./php-cs-fixer fix src --dry-run
phpstan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: '**/vendor'
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- uses: php-actions/composer@v5
- uses: php-actions/composer@v6
with:
args: --prefer-dist
php_version: 8.0
- name: PHPStan
uses: php-actions/phpstan@v2
uses: php-actions/phpstan@v3
with:
path: src/
level: 4
php_version: 8.0
php_version: '8.2'
43 changes: 43 additions & 0 deletions .github/workflows/rector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# github action that checks code with Rector
name: Rector

on: pull_request

jobs:
rector:
# Don't run on forks.
if: github.repository == 'php-etl/packaging-contracts'
runs-on: ubuntu-latest
steps:
# workaround for missing secret in fork PRs - see https://github.com/actions/checkout/issues/298
# see https://github.com/rectorphp/rector/commit/d395e1c28b8e6a56711dcc2e10490a82965850e4
-
if: github.event.pull_request.head.repo.full_name == github.repository
uses: actions/checkout@v3
with:
# Must be used to trigger workflow after push
token: ${{ secrets.ACCESS_TOKEN }}

# in forks, the token is not available - so we cannot use it
-
if: github.event.pull_request.head.repo.full_name != github.repository
uses: actions/checkout@v3

-
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none

- uses: "ramsey/composer-install@v2"

- run: bin/rector --ansi

-
# commit only to core contributors who have repository access
if: github.event.pull_request.head.repo.full_name == github.repository
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[rector] Rector fixes'
commit_author: 'GitHub Action <actions@github.com>'
commit_user_email: 'action@github.com'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/vendor/
bin/
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PHP82Migration' => true,
'@PHP81Migration' => true,
'@PHP80Migration:risky' => true,
'@PHPUnit84Migration:risky' => true,
Expand Down
48 changes: 27 additions & 21 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9374af7

Please sign in to comment.