Skip to content

Commit 4635a8f

Browse files
committed
update actions, add a rector action, add a php cs fixer config file, update project to php 8.2 with rector, validate cs fixer
1 parent 8e47984 commit 4635a8f

34 files changed

+778
-997
lines changed

.github/workflows/infection.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@ jobs:
44
infection:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v2
7+
- uses: actions/checkout@v3
88
- uses: shivammathur/setup-php@v2
99
with:
10-
php-version: '8.1'
10+
php-version: '8.2'
1111
tools: composer:v2
1212
coverage: pcov
13-
- uses: actions/cache@v2
13+
- uses: actions/cache@v3
1414
with:
1515
path: '**/vendor'
1616
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
1717
restore-keys: |
1818
${{ runner.os }}-composer-
19-
- uses: php-actions/composer@v5
19+
- uses: php-actions/composer@v6
2020
with:
2121
args: --prefer-dist
22-
php_version: 8.1
22+
php_version: '8.2'
2323

2424
- name: Infection
2525
run: |
26-
wget -q https://github.com/infection/infection/releases/download/0.26.10/infection.phar
27-
wget -q https://github.com/infection/infection/releases/download/0.26.10/infection.phar.asc
26+
wget -q https://github.com/infection/infection/releases/download/0.26.18/infection.phar
27+
wget -q https://github.com/infection/infection/releases/download/0.26.18/infection.phar.asc
2828
chmod +x infection.phar
2929
./infection.phar
3030
3131
- name: Store infection log
32-
uses: actions/upload-artifact@v2
32+
uses: actions/upload-artifact@v3
3333
with:
3434
path: infection.log

.github/workflows/phpstan-5.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ jobs:
44
phpstan:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v2
8-
- uses: actions/cache@v2
7+
- uses: actions/checkout@v3
8+
- uses: actions/cache@v3
99
with:
1010
path: '**/vendor'
1111
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
1212
restore-keys: |
1313
${{ runner.os }}-composer-
14-
- uses: php-actions/composer@v5
14+
- uses: php-actions/composer@v6
1515
with:
1616
args: --prefer-dist
17-
php_version: 8.1
17+
php_version: '8.2'
1818
- name: PHPStan
19-
uses: php-actions/phpstan@v2
19+
uses: php-actions/phpstan@v3
2020
with:
2121
path: src/
22-
args: --level=5
23-
php_version: 8.1
22+
level: 5
23+
php_version: '8.2'

.github/workflows/phpstan-6.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: PHPStan level 5
2+
on: push
3+
jobs:
4+
phpstan:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v3
8+
- uses: actions/cache@v3
9+
with:
10+
path: '**/vendor'
11+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
12+
restore-keys: |
13+
${{ runner.os }}-composer-
14+
- uses: php-actions/composer@v6
15+
with:
16+
args: --prefer-dist
17+
php_version: '8.2'
18+
- name: PHPStan
19+
uses: php-actions/phpstan@v3
20+
with:
21+
path: src/
22+
level: 6
23+
php_version: '8.2'

.github/workflows/phpstan-7.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ jobs:
44
phpstan:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v2
8-
- uses: actions/cache@v2
7+
- uses: actions/checkout@v3
8+
- uses: actions/cache@v3
99
with:
1010
path: '**/vendor'
1111
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
1212
restore-keys: |
1313
${{ runner.os }}-composer-
14-
- uses: php-actions/composer@v5
14+
- uses: php-actions/composer@v6
1515
with:
1616
args: --prefer-dist
17-
php_version: 8.1
17+
php_version: '8.2'
1818
- name: PHPStan
19-
uses: php-actions/phpstan@v2
19+
uses: php-actions/phpstan@v3
2020
with:
2121
path: src/
22-
args: --level=7
23-
php_version: 8.1
22+
level: 7
23+
php_version: '8.2'

.github/workflows/phpstan-8.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ jobs:
44
phpstan:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v2
8-
- uses: actions/cache@v2
7+
- uses: actions/checkout@v3
8+
- uses: actions/cache@v3
99
with:
1010
path: '**/vendor'
1111
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
1212
restore-keys: |
1313
${{ runner.os }}-composer-
14-
- uses: php-actions/composer@v5
14+
- uses: php-actions/composer@v6
1515
with:
1616
args: --prefer-dist
17-
php_version: 8.1
17+
php_version: '8.2'
1818
- name: PHPStan
19-
uses: php-actions/phpstan@v2
19+
uses: php-actions/phpstan@v3
2020
with:
2121
path: src/
22-
args: --level=8
23-
php_version: 8.1
22+
level: 8
23+
php_version: '8.2'

.github/workflows/quality.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
cs-fixer:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v2
7+
- uses: actions/checkout@v3
88
- name: Cs-Fixer
99
run: |
1010
wget -q https://cs.symfony.com/download/php-cs-fixer-v3.phar -O php-cs-fixer
@@ -14,47 +14,47 @@ jobs:
1414
phpunit:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
1818
- uses: shivammathur/setup-php@v2
1919
with:
20-
php-version: '8.1'
20+
php-version: '8.2'
2121
tools: composer:v2
2222
coverage: pcov
23-
- uses: actions/cache@v2
23+
- uses: actions/cache@v3
2424
with:
2525
path: '**/vendor'
2626
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
2727
restore-keys: |
2828
${{ runner.os }}-composer-
29-
- uses: php-actions/composer@v5
29+
- uses: php-actions/composer@v6
3030
with:
3131
args: --prefer-dist
32-
php_version: 8.1
32+
php_version: '8.2'
3333
- name: Run tests & generate Coverage
3434
run: bin/phpunit --configuration=phpunit.xml tests --coverage-html var/coverage --whitelist=src
3535
- name: Store coverage files
36-
uses: actions/upload-artifact@v2
36+
uses: actions/upload-artifact@v3
3737
with:
3838
path: var/coverage
3939

4040
phpstan:
4141
runs-on: ubuntu-latest
4242
steps:
43-
- uses: actions/checkout@v2
44-
- uses: actions/cache@v2
43+
- uses: actions/checkout@v3
44+
- uses: actions/cache@v3
4545
with:
4646
path: '**/vendor'
4747
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
4848
restore-keys: |
4949
${{ runner.os }}-composer-
50-
- uses: php-actions/composer@v5
50+
- uses: php-actions/composer@v6
5151
with:
5252
args: --prefer-dist
53-
php_version: 8.1
53+
php_version: '8.2'
5454

5555
- name: PHPStan
56-
uses: php-actions/phpstan@v2
56+
uses: php-actions/phpstan@v3
5757
with:
5858
path: src/
59-
args: --level=4
60-
php_version: 8.1
59+
level: 4
60+
php_version: '8.2'

.github/workflows/rector.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# github action that checks code with Rector
2+
name: Rector
3+
4+
on:
5+
pull_request: null
6+
7+
jobs:
8+
rector:
9+
runs-on: ubuntu-latest
10+
if: github.event.pull_request.head.repo.full_name == 'php-etl/phpunit-extension'
11+
steps:
12+
-
13+
if: github.event.pull_request.head.repo.full_name == github.repository
14+
uses: actions/checkout@v3
15+
with:
16+
# Must be used to trigger workflow after push
17+
token: ${{ secrets.ACCESS_TOKEN }}
18+
19+
-
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: '8.2'
23+
coverage: none
24+
25+
- uses: "ramsey/composer-install@v2"
26+
27+
- run: vendor/bin/rector --ansi
28+
29+
-
30+
# commit only to core contributors who have repository access
31+
uses: stefanzweifel/git-auto-commit-action@v4
32+
with:
33+
commit_message: '[rector] Rector fixes'
34+
commit_author: 'GitHub Action <[email protected]>'
35+
commit_user_email: '[email protected]'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/.idea/
22
/vendor/
3+
bin/
4+
.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in('src')
5+
;
6+
7+
return (new PhpCsFixer\Config())
8+
->setRiskyAllowed(true)
9+
->setRules([
10+
'@PHP82Migration' => true,
11+
'@PHP81Migration' => true,
12+
'@PHP80Migration:risky' => true,
13+
'@PHPUnit84Migration:risky' => true,
14+
'@PSR1' => true,
15+
'@PSR12' => true,
16+
'@PhpCsFixer' => true,
17+
'@Symfony' => true,
18+
'ternary_to_elvis_operator' => true,
19+
'set_type_to_cast' => true,
20+
'self_accessor' => true,
21+
'psr_autoloading' => true,
22+
'php_unit_test_annotation' => ['style' => 'annotation'],
23+
'php_unit_set_up_tear_down_visibility' => true,
24+
'php_unit_construct' => true,
25+
'no_useless_sprintf' => true,
26+
'no_homoglyph_names' => true,
27+
'native_function_invocation' => true,
28+
'native_constant_invocation' => true,
29+
'modernize_types_casting' => true,
30+
'logical_operators' => true,
31+
'is_null' => true,
32+
'function_to_constant' => true,
33+
'fopen_flag_order' => true,
34+
'error_suppression' => true,
35+
'ereg_to_preg' => true,
36+
'dir_constant' => true,
37+
'method_chaining_indentation' => false,
38+
])
39+
->setFinder($finder)
40+
->setCacheFile('.php-cs-fixer.cache') // forward compatibility with 3.x line
41+
;

composer.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "Extension for testing FastMap and ETL components with PHPUnit testing framework",
44
"type": "library",
55
"require": {
6-
"php": "^8.1",
7-
"phpunit/phpunit": "^9",
6+
"php": "^8.2",
7+
"phpunit/phpunit": "^10",
88
"nikic/php-parser": "^4.10",
99
"php-etl/pipeline-contracts": "^0.3.0",
1010
"php-http/message": "^1.11",
@@ -13,6 +13,10 @@
1313
"laminas/laminas-diactoros": "^2.6",
1414
"mikey179/vfsstream": "^1.6"
1515
},
16+
"require-dev": {
17+
"phpstan/phpstan": "^1.10",
18+
"rector/rector": "^0.15"
19+
},
1620
"license": "MIT",
1721
"authors": [
1822
{
@@ -33,7 +37,10 @@
3337
}
3438
},
3539
"config": {
36-
"bin-dir": "bin"
40+
"bin-dir": "bin",
41+
"allow-plugins": {
42+
"php-http/discovery": true
43+
}
3744
},
3845
"extra": {
3946
"branch-alias": {

0 commit comments

Comments
 (0)