Skip to content

Commit

Permalink
Add a phpstan lvl 6, validate cs-fixer, validate phpstan lvl3, add re…
Browse files Browse the repository at this point in the history
…ctor action, upgrade php 8.2 with rector
  • Loading branch information
JoMessina committed Mar 22, 2023
1 parent 391247d commit b51189e
Show file tree
Hide file tree
Showing 35 changed files with 4,002 additions and 1,255 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/infection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ jobs:
infection:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
tools: composer:v2
coverage: pcov
- uses: actions/cache@v2
- 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: Infection
run: |
wget -q https://github.com/infection/infection/releases/download/0.20.0/infection.phar
wget -q https://github.com/infection/infection/releases/download/0.20.0/infection.phar.asc
wget -q https://github.com/infection/infection/releases/download/0.26.18/infection.phar
wget -q https://github.com/infection/infection/releases/download/0.26.18/infection.phar.asc
chmod +x infection.phar
./infection.phar
- name: Store infection log
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
path: infection.log
12 changes: 6 additions & 6 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: 5
php_version: 8.0
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'
30 changes: 30 additions & 0 deletions .github/workflows/phpunit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: PHPUnit
on: push
jobs:
phpunit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:v2
coverage: pcov
- 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: Run tests & generate Coverage
run: bin/phpunit functional --coverage-html var/coverage

- name: Store coverage files
uses: actions/upload-artifact@v3
with:
path: var/coverage
50 changes: 14 additions & 36 deletions .github/workflows/quality.yaml
Original file line number Diff line number Diff line change
@@ -1,59 +1,37 @@
name: Quality (PHPStan level 4)
name: Quality (PHPStan level 3)
on: push
jobs:
cs-fixer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
- 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
phpunit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
tools: composer:v2
coverage: pcov
- uses: actions/cache@v2
with:
path: '**/vendor'
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- uses: php-actions/composer@v5
with:
args: --prefer-dist
php_version: 8.0
- name: Run tests & generate Coverage
run: bin/phpunit --configuration=phpunit.xml tests --coverage-html var/coverage --whitelist=src
- name: Store coverage files
uses: actions/upload-artifact@v2
with:
path: var/coverage

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: 3
php_version: '8.2'
39 changes: 39 additions & 0 deletions .github/workflows/rector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# github action that checks code with Rector
name: Rector

on:
pull_request: null

jobs:
rector:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == 'php-etl/pipeline'
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'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.idea/
vendor/
bin/
.php-cs-fixer.cache
.phpunit.result.cache
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ with logging, line rejections and execution states.


[![Quality](https://github.com/php-etl/pipeline/actions/workflows/quality.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/quality.yaml)
[![PHPUnit](https://github.com/php-etl/pipeline/actions/workflows/phpunit.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/phpunit.yaml)
[![Mutations](https://github.com/php-etl/pipeline/actions/workflows/infection.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/infection.yaml)
[![PHPStan level 5](https://github.com/php-etl/pipeline/actions/workflows/phpstan-5.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/phpstan-5.yaml)
[![PHPStan level 5](https://github.com/php-etl/pipeline/actions/workflows/phpstan-6.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/phpstan-6.yaml)
[![PHPStan level 7](https://github.com/php-etl/pipeline/actions/workflows/phpstan-7.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/phpstan-7.yaml)
[![PHPStan level 8](https://github.com/php-etl/pipeline/actions/workflows/phpstan-8.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/phpstan-8.yaml)
![PHP](https://img.shields.io/packagist/php-v/php-etl/pipeline)
Expand Down
24 changes: 16 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^8.0",
"php": "^8.2",
"psr/log": "^1.1",
"php-etl/bucket": "^0.2.0",
"php-etl/pipeline-contracts": "^0.3.0",
"php-etl/bucket-contracts": "^0.1.0"
"php-etl/bucket": "^0.3@dev",
"php-etl/pipeline-contracts": "^0.4@dev",
"php-etl/bucket-contracts": "^0.2@dev"
},
"require-dev": {
"phpunit/phpunit": "^9.0",
"johnkary/phpunit-speedtrap": "*",
"mybuilder/phpunit-accelerator": "*",
"phpunit/php-invoker": "*"
"phpunit/php-invoker": "*",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.5 || ^10.0",
"friendsofphp/php-cs-fixer": "^3.0",
"infection/infection": "^0.26.18",
"rector/rector": "^0.15"
},
"provide": {
"php-etl/pipeline-implementation": "0.3.0"
Expand All @@ -42,11 +46,15 @@
}
},
"config": {
"bin-dir": "bin"
"bin-dir": "bin",
"allow-plugins": {
"infection/extension-installer": true
}
},
"extra": {
"branch-alias": {
"dev-main": "0.4.x-dev"
"dev-main": "0.5.x-dev",
"dev-feature/qualityflow-improvments": "0.5.x-dev"
}
}
}

0 comments on commit b51189e

Please sign in to comment.