|
1 | | -name: Quality (PHPStan lvl 4) |
2 | | -on: push |
| 1 | +name: Quality |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, master, next] |
| 6 | + pull_request: |
| 7 | + branches: [main, master, next] |
| 8 | + |
| 9 | +env: |
| 10 | + PHP_VERSION: '8.4' |
| 11 | + |
3 | 12 | jobs: |
4 | | - cs-fixer: |
5 | | - runs-on: ubuntu-latest |
6 | | - steps: |
7 | | - - uses: actions/checkout@v3 |
8 | | - - uses: shivammathur/setup-php@v2 |
9 | | - with: |
10 | | - php-version: '8.2' |
11 | | - - name: Cs-Fixer |
12 | | - run: | |
13 | | - wget -q https://cs.symfony.com/download/php-cs-fixer-v3.phar -O php-cs-fixer |
14 | | - chmod a+x php-cs-fixer |
15 | | - PHP_CS_FIXER_IGNORE_ENV=true ./php-cs-fixer fix src --dry-run |
16 | | -
|
17 | | - phpstan: |
18 | | - runs-on: ubuntu-latest |
19 | | - steps: |
20 | | - - uses: actions/checkout@v3 |
21 | | - - uses: actions/cache@v3 |
22 | | - with: |
23 | | - path: '**/vendor' |
24 | | - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
25 | | - restore-keys: | |
26 | | - ${{ runner.os }}-composer- |
27 | | - - uses: php-actions/composer@v6 |
28 | | - with: |
29 | | - args: --prefer-dist |
30 | | - php_version: '8.2' |
31 | | - |
32 | | - - name: PHPStan |
33 | | - uses: php-actions/phpstan@v3 |
34 | | - with: |
35 | | - path: src/ |
36 | | - level: 8 |
| 13 | + quality: |
| 14 | + name: PHP-CS-Fixer, PHPStan, Rector, PHPUnit, Infection, PHPSpec |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - uses: shivammathur/setup-php@v2 |
| 20 | + with: |
| 21 | + php-version: ${{ env.PHP_VERSION }} |
| 22 | + tools: composer:v2 |
| 23 | + coverage: pcov |
| 24 | + |
| 25 | + - uses: actions/cache@v4 |
| 26 | + with: |
| 27 | + path: vendor |
| 28 | + key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock', 'composer.json') }} |
| 29 | + restore-keys: | |
| 30 | + ${{ runner.os }}-composer- |
| 31 | +
|
| 32 | + - name: Install dependencies |
| 33 | + run: composer install --no-interaction --prefer-dist |
| 34 | + |
| 35 | + - name: PHP-CS-Fixer |
| 36 | + run: | |
| 37 | + if [ -f vendor/bin/php-cs-fixer ] && [ -d src ]; then |
| 38 | + vendor/bin/php-cs-fixer fix src --dry-run |
| 39 | + fi |
| 40 | +
|
| 41 | + - name: PHPStan |
| 42 | + run: | |
| 43 | + if [ ! -d src ]; then exit 0; fi |
| 44 | + if [ -f vendor/bin/phpstan ]; then |
| 45 | + vendor/bin/phpstan analyse src --level=8 --no-progress |
| 46 | + elif [ -f vendor/phpstan/phpstan/phpstan ]; then |
| 47 | + php vendor/phpstan/phpstan/phpstan analyse src --level=8 --no-progress |
| 48 | + fi |
| 49 | +
|
| 50 | + - name: Rector |
| 51 | + run: | |
| 52 | + if [ -f bin/rector ]; then |
| 53 | + bin/rector process --dry-run |
| 54 | + elif [ -f vendor/bin/rector ]; then |
| 55 | + vendor/bin/rector process --dry-run |
| 56 | + fi |
| 57 | +
|
| 58 | + - name: PHPUnit |
| 59 | + run: | |
| 60 | + if [ -f phpunit.xml ] || [ -f phpunit.xml.dist ]; then |
| 61 | + if [ -f infection.json ] || [ -f infection.json.dist ]; then |
| 62 | + vendor/bin/phpunit --coverage-html var/coverage --coverage-text |
| 63 | + else |
| 64 | + vendor/bin/phpunit |
| 65 | + fi |
| 66 | + fi |
| 67 | +
|
| 68 | + - name: Infection |
| 69 | + run: | |
| 70 | + if [ -f infection.json ] || [ -f infection.json.dist ]; then |
| 71 | + vendor/bin/infection run --no-progress --min-msi=0 --min-covered-msi=0 |
| 72 | + fi |
| 73 | +
|
| 74 | + - name: PHPSpec |
| 75 | + run: | |
| 76 | + if [ -f bin/phpspec ] && [ -d spec ]; then |
| 77 | + bin/phpspec run spec |
| 78 | + fi |
0 commit comments