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-5.yaml b/.github/workflows/phpstan-5.yaml deleted file mode 100644 index 0f74e33..0000000 --- a/.github/workflows/phpstan-5.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: PHPStan level 5 -on: push -jobs: - phpstan5: - 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-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 710113c..0000000 --- a/.github/workflows/phpunit.yaml +++ /dev/null @@ -1,31 +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 - extension: pdo - 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 96ea004..56fde70 100644 --- a/.github/workflows/quality.yaml +++ b/.github/workflows/quality.yaml @@ -1,37 +1,78 @@ name: Quality -on: push + +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=4 + 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 4180d48..0000000 --- a/.github/workflows/rector.yaml +++ /dev/null @@ -1,30 +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/sql-plugin' - steps: - - 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 01ab307..63320ab 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,10 @@ { "name": "php-etl/sql-plugin", + "repositories": [ + {"type": "path", "url": "../fast-map"}, + {"type": "path", "url": "../../tools/fast-map-config"}, + {"type": "path", "url": "../../phpunit-extension"} + ], "description": "This plugin allows you to perform SQL queries in the ETL pipelines", "type": "gyroscops-plugin", "license": "MIT", @@ -25,12 +30,12 @@ "ext-pdo": "*", "phpunit/phpunit": "^10.0", "php-etl/phpunit-extension": "*", - "phpstan/phpstan": "^2.2", + "phpstan/phpstan": "^2.1", "php-etl/sql-flow": "*", "friendsofphp/php-cs-fixer": "^3.0", "mikey179/vfsstream": "^1.6", - "infection/infection": "^0.26.18", - "rector/rector": "^2.0" + "infection/infection": "^0.28", + "rector/rector": "^2.3" }, "autoload": { "psr-4": {