Skip to content

Commit

Permalink
Increase required PHP version to 8.1 (#20)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Auswöger <[email protected]>
  • Loading branch information
leofeyer and ausi authored Mar 27, 2024
1 parent bf5fae7 commit 1606370
Show file tree
Hide file tree
Showing 23 changed files with 358 additions and 462 deletions.
74 changes: 48 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
tags:
- '*'
schedule:
- cron: 0 13 * * MON,TUE
- cron: 0 13 * * MON,THU

jobs:
coverage:
Expand All @@ -19,25 +19,26 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.1
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib
tools: prestissimo, flex
coverage: none
coverage: pcov

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install the dependencies
run: composer install --no-interaction --no-suggest
run: composer install --no-interaction --no-progress

- name: Generate the coverage report
run: phpdbg -qrr vendor/bin/phpunit --coverage-clover=clover.xml --colors=always
run: php -d pcov.enabled=1 vendor/bin/phpunit --coverage-clover=clover.xml --colors=always

- name: Upload the coverage report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: ./clover.xml
files: ./clover.xml
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

coding-style:
name: Coding Style
Expand All @@ -47,23 +48,24 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.1
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib
tools: prestissimo, flex
coverage: none

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install the dependencies
run: composer install --no-interaction --no-suggest
run: composer install --no-interaction --no-progress

- name: Run Rector
run: vendor/bin/rector --dry-run --no-progress-bar --ansi

- name: Check the coding style
run: vendor/bin/ecs check src tests --config ecs.php --no-progress-bar --ansi
- name: Run ECS
run: vendor/bin/ecs check --no-progress-bar --ansi

- name: Analyze the code
run: |
vendor/bin/phpstan analyse src tests --level=5 --no-progress
- name: Run PHPStan
run: vendor/bin/phpstan analyse --no-progress

tests:
name: PHP ${{ matrix.php }}
Expand All @@ -72,21 +74,42 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4]
php: [8.1, 8.2, 8.3]
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib
coverage: none

- name: Checkout
uses: actions/checkout@v3

- name: Install the dependencies
run: composer install --no-interaction --no-progress

- name: Run the unit tests
run: vendor/bin/phpunit --colors=always

nightly:
name: PHP 8.4
runs-on: ubuntu-latest
if: github.event_name != 'push'
continue-on-error: true
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib
tools: prestissimo, flex
coverage: none

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install the dependencies
run: composer install --no-interaction --no-suggest
run: composer install --ignore-platform-req=php+ --no-interaction --no-progress

- name: Run the unit tests
run: vendor/bin/phpunit --colors=always
Expand All @@ -99,16 +122,15 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.1
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib
tools: prestissimo, flex
coverage: none

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install the dependencies
run: composer update --prefer-lowest --prefer-stable --no-interaction --no-suggest
run: composer update --prefer-lowest --prefer-stable --no-interaction --no-progress

- name: Run the unit tests
run: vendor/bin/phpunit --colors=always
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
/.monorepo-split-cache/
/.monorepo-merge-cache/
# Composer
/vendor/
/composer.lock

# Monorepo Tools
/.monorepo-split-cache/
/.monorepo-merge-cache/

# PhpUnit
/.phpunit.result.cache
/phpunit.xml
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [Unreleased]

* Update Symfony versions to 5.4, 6.4, 7.0. [#22]
* Increase required PHP version to 8.1 [#20]

## [0.1.0] (2024-03-27)

Expand All @@ -14,3 +15,4 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
[0.1.0]: https://github.com/contao/monorepo-tools/commits/0.1.0

[#22]: https://github.com/contao/monorepo-tools/issues/22
[#20]: https://github.com/contao/monorepo-tools/issues/20
10 changes: 5 additions & 5 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
coverage:
status:
patch: false
project:
default:
threshold: 0.2%
status:
patch: false
project:
default:
threshold: 0.2%

comment: false
35 changes: 15 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.1",
"ext-json": "*",
"ext-zlib": "*",
"composer/semver": "^3.2",
Expand All @@ -22,10 +22,9 @@
"symfony/yaml": "^5.4 || ^6.4 || ^7.0"
},
"require-dev": {
"contao/easy-coding-standard": "^1.3",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12.8",
"phpstan/phpstan-symfony": "^0.12.6",
"contao/code-quality": "^1.0",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^9.5"
},
"conflict": {
Expand All @@ -44,25 +43,21 @@
"bin": [
"bin/monorepo-tools"
],
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"all": [
"@rector",
"@ecs",
"@unit-tests",
"@cs-fixer",
"@phpstan"
],
"cs-fixer": [
"vendor/bin/ecs check src tests --config ecs.php --fix --ansi"
],
"phpstan": [
"vendor/bin/phpstan analyze src tests --level=5 --memory-limit=1G --ansi"
],
"unit-tests": [
"vendor/bin/phpunit --colors=always"
]
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
"ecs": "@php vendor/bin/ecs check --fix --ansi",
"phpstan": "@php vendor/bin/phpstan analyze --ansi",
"rector": "@php vendor/bin/rector --ansi",
"unit-tests": "@php vendor/bin/phpunit --colors=always"
}
}
30 changes: 20 additions & 10 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@
* @license LGPL-3.0-or-later
*/

use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
use PhpCsFixer\Fixer\Operator\NoUselessConcatOperatorFixer;
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__.'/vendor/contao/easy-coding-standard/config/set/contao.php');

$parameters = $containerConfigurator->parameters();

$parameters->set(Option::SKIP, [
return ECSConfig::configure()
->withSets([__DIR__.'/vendor/contao/code-quality/config/ecs.php'])
->withPaths([
__DIR__.'/src',
__DIR__.'/tests',
])
->withSkip([
MethodChainingIndentationFixer::class => [
'*/Config/MonorepoConfiguration.php',
'src/Config/MonorepoConfiguration.php',
],
NoUselessConcatOperatorFixer::class => [
'tests/Git/TreeTest.php',
],
]);
};
])
->withParallel()
->withSpacing(Option::INDENTATION_SPACES, "\n")
->withConfiguredRule(HeaderCommentFixer::class, ['header' => "This file is part of Contao.\n\n(c) Leo Feyer\n\n@license LGPL-3.0-or-later"])
->withCache(sys_get_temp_dir().'/ecs_monorepo_cache')
;
10 changes: 10 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
includes:
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-symfony/rules.neon

parameters:
level: 5

paths:
- %currentWorkingDirectory%/src
- %currentWorkingDirectory%/tests
5 changes: 0 additions & 5 deletions phpstan.neon.dist

This file was deleted.

36 changes: 14 additions & 22 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>
<php>
<ini name="error_reporting" value="-1" />
</php>

<testsuites>
<testsuite name="Contao Monorepo Tools">
<directory>./tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd" colors="true" bootstrap="vendor/autoload.php">
<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>
<php>
<ini name="error_reporting" value="-1" />
</php>
<testsuites>
<testsuite name="Contao Monorepo Tools">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
21 changes: 21 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;

return RectorConfig::configure()
->withSets([__DIR__.'/vendor/contao/code-quality/config/rector.php'])
->withPaths([
__DIR__.'/src',
__DIR__.'/tests',
])
->withSkip([
JsonThrowOnErrorRector::class,
NullToStrictStringFuncCallArgRector::class,
])
->withParallel()
->withCache(sys_get_temp_dir().'/rector_monorepo_cache')
;
Loading

0 comments on commit 1606370

Please sign in to comment.