|
| 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 | + |
| 12 | +jobs: |
| 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