diff --git a/.github/workflows/infection.yaml b/.github/workflows/infection.yaml deleted file mode 100644 index c5adb1e..0000000 --- a/.github/workflows/infection.yaml +++ /dev/null @@ -1,34 +0,0 @@ -name: Mutations -on: push -jobs: - infection: - 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: Infection - run: | - 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@v3 - with: - path: infection.log diff --git a/.github/workflows/phpstan-6.yaml b/.github/workflows/phpstan-6.yaml deleted file mode 100644 index fcd8a2d..0000000 --- a/.github/workflows/phpstan-6.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: PHPStan level 6 -on: push -jobs: - phpstan6: - 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: 8 diff --git a/.github/workflows/phpstan-7.yaml b/.github/workflows/phpstan-7.yaml deleted file mode 100644 index b8ca10d..0000000 --- a/.github/workflows/phpstan-7.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: PHPStan level 7 -on: push -jobs: - phpstan7: - 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: 8 diff --git a/.github/workflows/phpstan-8.yaml b/.github/workflows/phpstan-8.yaml deleted file mode 100644 index addb6be..0000000 --- a/.github/workflows/phpstan-8.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: PHPStan level 8 -on: push -jobs: - phpstan8: - 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: 8 diff --git a/.github/workflows/phpunit.yaml b/.github/workflows/phpunit.yaml deleted file mode 100644 index cc4fc19..0000000 --- a/.github/workflows/phpunit.yaml +++ /dev/null @@ -1,30 +0,0 @@ -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 --coverage-html var/coverage - - - name: Store coverage files - uses: actions/upload-artifact@v3 - with: - path: var/coverage diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml index d69054c..56fde70 100644 --- a/.github/workflows/quality.yaml +++ b/.github/workflows/quality.yaml @@ -1,37 +1,78 @@ -name: Quality (PHPStan lvl 5) -on: push +name: Quality + +on: + push: + branches: [main, master, next] + pull_request: + branches: [main, master, next] + +env: + PHP_VERSION: '8.4' + jobs: - cs-fixer: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.2' - - name: Cs-Fixer - run: | - 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 --dry-run --config=.php-cs-fixer.dist.php - - 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/ - args: --level=5 + quality: + name: PHP-CS-Fixer, PHPStan, Rector, PHPUnit, Infection, PHPSpec + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ env.PHP_VERSION }} + tools: composer:v2 + coverage: pcov + + - uses: actions/cache@v4 + with: + path: vendor + key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock', 'composer.json') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --no-interaction --prefer-dist + + - name: PHP-CS-Fixer + run: | + if [ -f vendor/bin/php-cs-fixer ] && [ -d src ]; then + vendor/bin/php-cs-fixer fix src --dry-run + fi + + - name: PHPStan + run: | + if [ ! -d src ]; then exit 0; fi + if [ -f vendor/bin/phpstan ]; then + vendor/bin/phpstan analyse src --level=8 --no-progress + elif [ -f vendor/phpstan/phpstan/phpstan ]; then + php vendor/phpstan/phpstan/phpstan analyse src --level=8 --no-progress + fi + + - name: Rector + run: | + if [ -f bin/rector ]; then + bin/rector process --dry-run + elif [ -f vendor/bin/rector ]; then + vendor/bin/rector process --dry-run + fi + + - name: PHPUnit + run: | + if [ -f phpunit.xml ] || [ -f phpunit.xml.dist ]; then + if [ -f infection.json ] || [ -f infection.json.dist ]; then + vendor/bin/phpunit --coverage-html var/coverage --coverage-text + else + vendor/bin/phpunit + fi + fi + + - name: Infection + run: | + if [ -f infection.json ] || [ -f infection.json.dist ]; then + vendor/bin/infection run --no-progress --min-msi=0 --min-covered-msi=0 + fi + - name: PHPSpec + run: | + if [ -f bin/phpspec ] && [ -d spec ]; then + bin/phpspec run spec + fi diff --git a/.github/workflows/rector.yaml b/.github/workflows/rector.yaml deleted file mode 100644 index 9596da1..0000000 --- a/.github/workflows/rector.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# 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/string-expression-language' - steps: - - - 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 - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: '[rector] Rector fixes' - commit_author: 'GitHub Action ' - commit_user_email: 'action@github.com' diff --git a/composer.json b/composer.json index 57d3f36..678e2c1 100644 --- a/composer.json +++ b/composer.json @@ -17,8 +17,8 @@ }, "require-dev": { "phpunit/phpunit": "^10.0", - "rector/rector": "^2.0", - "phpstan/phpstan": "^2.2", + "rector/rector": "^2.3", + "phpstan/phpstan": "^2.1", "friendsofphp/php-cs-fixer": "^3.38" }, "autoload": { diff --git a/composer.lock b/composer.lock index eeb2235..4d8e0cd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0d32a85e43f180b0741a98ce31d293a6", + "content-hash": "c0688a3e58b9ef9611d947087fb341c1", "packages": [ { "name": "psr/cache", @@ -1378,11 +1378,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.2.x-dev", + "version": "2.1.40", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4a1379b1e4a1b0fe04ab20efc25a473a359e1e12", - "reference": "4a1379b1e4a1b0fe04ab20efc25a473a359e1e12", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9b2c7aeb83a75d8680ea5e7c9b7fca88052b766b", + "reference": "9b2c7aeb83a75d8680ea5e7c9b7fca88052b766b", "shasum": "" }, "require": { @@ -1391,7 +1391,6 @@ "conflict": { "phpstan/phpstan-shim": "*" }, - "default-branch": true, "bin": [ "phpstan", "phpstan.phar" @@ -1428,7 +1427,7 @@ "type": "github" } ], - "time": "2026-03-11T13:18:18+00:00" + "time": "2026-02-23T15:04:35+00:00" }, { "name": "phpunit/php-code-coverage",