diff --git a/.github/workflows/code_checks.yaml b/.github/workflows/code_checks.yaml deleted file mode 100644 index cdd57a8..0000000 --- a/.github/workflows/code_checks.yaml +++ /dev/null @@ -1,131 +0,0 @@ -name: Code_Checks - -on: [push, pull_request] - -jobs: - tests: - runs-on: ubuntu-20.04 - strategy: - matrix: - php: - - '8.0' - - '8.1' - - '8.2' - - '8.3' - dependencies: - - 'low' - - 'high' - symfony_version: - - "~v5.4.9" - - "~v6.3.0" - exclude: - - php: '8.0' - dependencies: 'low' - symfony_version: "~v6.3.0" - - php: '8.0' - dependencies: 'high' - symfony_version: "~v6.3.0" - - name: PHP ${{ matrix.php }} / Symfony ${{ matrix.symfony_version }} / deps '${{ matrix.dependencies }}' / Ubuntu - steps: - - uses: actions/checkout@v2 - - - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none # disable xdebug, pcov - - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: php-${{ matrix.php }}-ubuntu-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - php-${{ matrix.php }}-ubuntu-composer- - - - run: php ./composer-install.php "${{ matrix.symfony_version }}" "${{ matrix.dependencies }}" "--no-interaction --no-progress --prefer-dist" - - - run: vendor/bin/phpunit - - windows-tests: - runs-on: windows-2022 - strategy: - matrix: - php: - - '8.0' - - name: PHP ${{ matrix.php }} tests on Windows - steps: - - uses: actions/checkout@v2 - - - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none # disable xdebug, pcov - extensions: 'curl' - - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: php-${{ matrix.php }}-windows-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - php-${{ matrix.php }}-windows-composer- - - - run: composer update -a --prefer-dist -n - - - run: vendor/bin/phpunit - - static_analysis: - runs-on: ubuntu-20.04 - strategy: - matrix: - include: - - php: '8.1' - symfony_version: "~v6.1.0" - dependencies: "high" - - name: Static analysis - steps: - - uses: actions/checkout@v2 - - - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none # disable xdebug, pcov - - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: php-${{ matrix.php }}-ubuntu-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - php-${{ matrix.php }}-ubuntu-composer- - - - run: php ./composer-install.php "${{ matrix.symfony_version }}" "${{ matrix.dependencies }}" "--no-interaction --no-progress --prefer-dist" - - - run: composer normalize --dry-run - - - uses: actions/cache@v3 - with: - path: .php-cs-fixer.cache - key: php-cs-fixer-cache - - - uses: actions/cache@v3 - with: - path: /tmp/phpstan - key: phpstan-cache - - - run: composer crunz:analyze diff --git a/.github/workflows/php.yaml b/.github/workflows/php.yaml new file mode 100644 index 0000000..7ee1f09 --- /dev/null +++ b/.github/workflows/php.yaml @@ -0,0 +1,104 @@ +name: PHP + +on: + pull_request: + branches: + - '3.5' + - '3.6' + push: null + +permissions: {} + +concurrency: + group: '${{ github.workflow }}-${{ github.ref }}' + cancel-in-progress: true + +jobs: + tests: + name: '${{ matrix.php }} / Symfony ${{ matrix.symfony_version }} / ${{ matrix.dependencies }} / ${{ matrix.os }}' + strategy: + matrix: + os: + - 'ubuntu-22.04' + php: + - '8.0' + - '8.1' + - '8.2' + - '8.3' + dependencies: + - 'lowest' + - 'highest' + symfony_version: + - '~5.4.9' + - '~6.3.0' + include: + - os: 'windows-2022' + php: '8.1' + dependencies: 'highest' + symfony_version: '~6.3.0' + exclude: + - os: 'ubuntu-22.04' + php: '8.0' + dependencies: 'lowest' + symfony_version: '~6.3.0' + - os: 'ubuntu-22.04' + php: '8.0' + dependencies: 'highest' + symfony_version: '~6.3.0' + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - uses: ramsey/composer-install@v2 + with: + dependency-versions: ${{ matrix.dependencies }} + composer-options: '--with=symfony/console:${{ matrix.symfony_version }}' + + - run: composer exec -- phpunit --testsuite EndToEnd + + - run: composer exec -- phpunit --testsuite Integration + + - run: composer exec -- phpunit --testsuite Unit + + static_analysis: + name: Static analysis + strategy: + matrix: + include: + - php: '8.1' + symfony_version: '~6.3.0' + dependencies: 'highest' + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - uses: ramsey/composer-install@v2 + with: + dependency-versions: ${{ matrix.dependencies }} + composer-options: '--with=symfony/console:${{ matrix.symfony_version }}' + + - run: composer normalize --dry-run + + - uses: actions/cache@v3 + with: + path: .php-cs-fixer.cache + key: php-cs-fixer-cache + + - uses: actions/cache@v3 + with: + path: /tmp/phpstan + key: phpstan-cache + + - run: composer run crunz:analyze diff --git a/composer-install.php b/composer-install.php deleted file mode 100755 index eec6146..0000000 --- a/composer-install.php +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env php - &$packageVersion) { - $isIgnored = \in_array( - $packageName, - $ignoredPackages, - true - ); - - if ($isIgnored) { - continue; - } - - if (!\str_contains($packageName, 'symfony/')) { - continue; - } - - $packageVersion = $version; - } - - return $packages; -}; - -$composerJson = \json_decode( - \file_get_contents($composerFilePath), - true -); -$packages = $composerJson['require'] ?? []; -$packagesDev = $composerJson['require-dev'] ?? []; -$composerJson['require'] = $changeVersion($packages); -$composerJson['require-dev'] = $changeVersion($packagesDev); - -\file_put_contents( - $composerFilePath, - \json_encode($composerJson, JSON_PRETTY_PRINT) -); - -$preferLowest = ''; -if ('high' !== $dependenciesEnv) { - $preferLowest = '--prefer-lowest'; -} - -$command = \trim("composer update -o {$defaultComposerFlags} {$preferLowest}"); -echo $command, PHP_EOL; -echo \shell_exec($command); diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e655803..348f89c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -76,7 +76,7 @@ parameters: path: src/Console/Command/TaskGeneratorCommand.php - - message: "#^Cannot call method ask\\(\\) on mixed\\.$#" + message: "#^Call to an undefined method Symfony\\\\Component\\\\Console\\\\Helper\\\\HelperInterface\\:\\:ask\\(\\)\\.$#" count: 1 path: src/Console/Command/TaskGeneratorCommand.php @@ -115,21 +115,11 @@ parameters: count: 1 path: src/Event.php - - - message: "#^Call to method createLock\\(\\) on an unknown class Symfony\\\\Component\\\\Lock\\\\Factory\\.$#" - count: 1 - path: src/Event.php - - message: "#^Cannot cast mixed to string\\.$#" count: 1 path: src/Event.php - - - message: "#^Class Symfony\\\\Component\\\\Lock\\\\StoreInterface not found\\.$#" - count: 2 - path: src/Event.php - - message: "#^Instanceof between Closure and Closure will always evaluate to true\\.$#" count: 1 @@ -140,11 +130,6 @@ parameters: count: 1 path: src/Event.php - - - message: "#^Instanceof between Symfony\\\\Component\\\\Lock\\\\StoreInterface and Symfony\\\\Component\\\\Lock\\\\StoreInterface will always evaluate to true\\.$#" - count: 1 - path: src/Event.php - - message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#" count: 1 @@ -165,21 +150,11 @@ parameters: count: 3 path: src/Event.php - - - message: "#^Parameter \\$store of method Crunz\\\\Event\\:\\:preventOverlapping\\(\\) has invalid type Symfony\\\\Component\\\\Lock\\\\StoreInterface\\.$#" - count: 1 - path: src/Event.php - - message: "#^Property Crunz\\\\Event\\:\\:\\$lock \\(Symfony\\\\Component\\\\Lock\\\\Lock\\) does not accept Symfony\\\\Component\\\\Lock\\\\SharedLockInterface\\.$#" count: 1 path: src/Event.php - - - message: "#^Property Crunz\\\\Event\\:\\:\\$lockFactory has unknown class Symfony\\\\Component\\\\Lock\\\\Factory as its type\\.$#" - count: 1 - path: src/Event.php - - message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#" count: 1 @@ -396,12 +371,12 @@ parameters: path: tests/EndToEnd/WrongTaskTest.php - - message: "#^Call to function method_exists\\(\\) with Symfony\\\\Component\\\\Console\\\\Tester\\\\CommandTester and 'setInputs' will always evaluate to true\\.$#" + message: "#^Call to an undefined method Symfony\\\\Component\\\\Console\\\\Helper\\\\HelperInterface\\:\\:setInputStream\\(\\)\\.$#" count: 1 path: tests/Functional/TaskGeneratorTest.php - - message: "#^Cannot call method setInputStream\\(\\) on mixed\\.$#" + message: "#^Call to function method_exists\\(\\) with Symfony\\\\Component\\\\Console\\\\Tester\\\\CommandTester and 'setInputs' will always evaluate to true\\.$#" count: 1 path: tests/Functional/TaskGeneratorTest.php