diff --git a/.github/workflows/tasks.yml b/.github/workflows/tasks.yml index 4827bdf..1ee0b00 100644 --- a/.github/workflows/tasks.yml +++ b/.github/workflows/tasks.yml @@ -1,28 +1,41 @@ name: Tasks - -on: [push, pull_request] - +'on': + - push + - pull_request jobs: - lint-php: - name: "php: ${{ matrix.php }} TYPO3: ${{ matrix.typo3 }}" + compatibility: + name: Compatibility PHP ${{ matrix.php }} / TYPO3 ${{ matrix.typo3 }} / ${{ matrix.dependencies }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: - php: [ '8.2', '8.3', '8.4' ] - typo3: [ '12', '13' ] + include: + - php: '8.2' + typo3: '13' + dependencies: latest + - php: '8.3' + typo3: '13' + dependencies: latest + - php: '8.4' + typo3: '13' + dependencies: latest + - php: '8.5' + typo3: '13' + dependencies: latest + - php: '8.2' + typo3: '13' + dependencies: lowest + - php: '8.5' + typo3: '13' + dependencies: lowest steps: - - name: Setup PHP with PECL extension - uses: shivammathur/setup-php@v2 + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - - uses: actions/checkout@v2 - - uses: actions/cache@v3 - with: - path: ~/.composer/cache/files - key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.php }}-composer- - - run: composer require typo3/minimal="^${{ matrix.typo3 }}" --dev --ignore-platform-req=php+ - - run: composer install --no-interaction --no-progress --ignore-platform-req=php+ - - run: ./vendor/bin/grumphp run --ansi + extensions: apcu, bcmath, gd, intl, mbstring, pdo_sqlite, sqlite3, zip + coverage: pcov + tools: composer:v2 + ini-values: apc.enable_cli=1, memory_limit=1G + - name: Resolve and check compatibility + run: sh Build/Scripts/check-compatibility.sh ${{ matrix.php }} ${{ matrix.typo3 }} ${{ matrix.dependencies }} diff --git a/Build/Configuration/PHP/testing.ini b/Build/Configuration/PHP/testing.ini new file mode 100644 index 0000000..daef18b --- /dev/null +++ b/Build/Configuration/PHP/testing.ini @@ -0,0 +1,3 @@ +apc.enable_cli=1 +memory_limit=1G +error_reporting=E_ALL diff --git a/Build/Scripts/check-compatibility.sh b/Build/Scripts/check-compatibility.sh new file mode 100644 index 0000000..9db8be7 --- /dev/null +++ b/Build/Scripts/check-compatibility.sh @@ -0,0 +1,46 @@ +#!/bin/sh +set -eu + +php_version="${1:?PHP version required}" +typo3_version="${2:?TYPO3 major required}" +dependencies="${3:-latest}" + +php -r 'exit(PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION === $argv[1] ? 0 : 1);' "$php_version" +php -v +composer self-update --2 --no-interaction +composer --version +case "$php_version:$typo3_version" in + 8.2:13|8.3:13|8.4:13|8.5:13) ;; + *) printf 'Unsupported PHP/TYPO3 pair: %s / %s\n' "$php_version" "$typo3_version"; exit 1 ;; +esac +case "$dependencies" in latest|lowest) ;; *) exit 1 ;; esac + +export GRUMPHP_GIT_HOOKS_ENABLED=0 +export typo3DatabaseDriver=pdo_sqlite +export XDEBUG_MODE=off +export PHP_INI_SCAN_DIR="${PHP_INI_SCAN_DIR:-}:$(pwd)/Build/Configuration/PHP" + +composer validate --no-check-publish --no-interaction +composer config lock true +composer require --dev --sort-packages 'squizlabs/php_codesniffer:^3.8.0 || ^4.0' --no-update --no-interaction +case "$typo3_version" in + 13) + constraint='^13.4' + composer require --dev --sort-packages 'saschaegerer/phpstan-typo3:^2.2.0' 'ssch/typo3-rector:^3.16.0' 'rector/rector:^2.7.0' 'pluswerk/grumphp-config:^11.2.0' --no-update --no-interaction + ;; +esac +composer require --dev --sort-packages "typo3/minimal:$constraint" --no-update --no-interaction +if [ "$php_version" = 8.5 ]; then + composer require --dev --sort-packages 'phpunit/phpunit:^10.5.62 || ^11.5.50 || ^12.5.0 || ^13.0.2' --no-update --no-interaction +fi +if [ "$dependencies" = lowest ]; then + composer update --with-all-dependencies --prefer-lowest --prefer-stable --no-interaction --no-progress --no-scripts +else + composer update --with-all-dependencies --prefer-stable --no-interaction --no-progress --no-scripts +fi +composer check-platform-reqs +if [ "$php_version" = 8.5 ]; then + composer prohibits php 8.5.0 || true +fi + +php vendor/bin/grumphp run --no-interaction diff --git a/composer.json b/composer.json index a1ba01f..93b9575 100644 --- a/composer.json +++ b/composer.json @@ -6,12 +6,12 @@ ], "type": "typo3-cms-extension", "require": { - "php": "~8.2.0 || ~8.3.0 || ~8.4.0", - "typo3/cms-core": "^12.4 || ^13.4", - "typo3/cms-frontend": "^12.4 || ^13.4" + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "typo3/cms-core": "^13.4", + "typo3/cms-frontend": "^13.4" }, "require-dev": { - "pluswerk/grumphp-config": "^7.2.0 || ^10.1.4", + "pluswerk/grumphp-config": "^7.2.0 || ^10.1.4 || ^11.2.0", "saschaegerer/phpstan-typo3": "^1.10.2 || ^2.1.1", "ssch/typo3-rector": "*" }, @@ -22,6 +22,7 @@ }, "config": { "allow-plugins": { + "a9f/fractor-extension-installer": true, "ergebnis/composer-normalize": true, "phpro/grumphp": true, "phpstan/extension-installer": true, diff --git a/grumphp.yml b/grumphp.yml index f682bd0..c33a573 100644 --- a/grumphp.yml +++ b/grumphp.yml @@ -1,6 +1,10 @@ imports: - { resource: vendor/pluswerk/grumphp-config/grumphp.yml } +grumphp: + parallel: + enabled: false parameters: + convention.fractor_enable: false convention.process_timeout: 240 convention.security_checker_blocking: false convention.jsonlint_ignore_pattern: { } diff --git a/rector.php b/rector.php index fe73218..d9aac2b 100644 --- a/rector.php +++ b/rector.php @@ -4,13 +4,12 @@ use PLUS\GrumPHPConfig\RectorSettings; use Rector\Config\RectorConfig; -use Rector\Caching\ValueObject\Storage\FileCacheStorage; return static function (RectorConfig $rectorConfig): void { + $rectorConfig->phpVersion(80200); $rectorConfig->parallel(); $rectorConfig->importNames(); $rectorConfig->importShortClasses(); - $rectorConfig->cacheClass(FileCacheStorage::class); $rectorConfig->cacheDirectory('./var/cache/rector'); $rectorConfig->paths(