diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 55ce0fa..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,76 +0,0 @@ -version: 2 - -jobs: - php: - docker: - - image: becklyn/circleci-php7.4:latest - - steps: - - checkout - - # Download and cache dependencies - - restore_cache: - name: Restore Composer Main Cache - keys: - - composer-dependencies-v2-{{ checksum "composer.json" }} - # fallback to using the latest cache if no exact match is found - - composer-dependencies-v2- - - - - restore_cache: - name: Restore Composer Bin Cache - keys: - - composer-bin-dependencies-v2-{{ checksum "vendor-bin/test/composer.json" }} - # fallback to using the latest cache if no exact match is found - - composer-bin-dependencies-v2- - - - run: - name: Composer Install - command: COMPOSER_MEMORY_LIMIT=-1 composer install --no-interaction --prefer-dist --no-progress --no-suggest - - run: - name: Install Composer Normalize + Bin Plugin - command: COMPOSER_MEMORY_LIMIT=-1 composer global require localheinz/composer-normalize bamarni/composer-bin-plugin --no-interaction --prefer-dist --no-progress --no-suggest - - run: - name: Composer Install (bin) - command: COMPOSER_MEMORY_LIMIT=-1 composer bin all install --no-interaction --prefer-dist --no-progress --no-suggest - - run: - name: Composer Log Directory for php-coveralls - command: mkdir -p build/logs - - - # RUN - - run: - name: Composer Normalize - command: COMPOSER_MEMORY_LIMIT=-1 composer normalize --indent-size 4 --indent-style space --dry-run - - run: - name: PHP CS Fixer - command: ./vendor/bin/php-cs-fixer fix --diff --config vendor-bin/test/vendor/becklyn/php-cs/.php_cs.dist.php --dry-run --no-interaction - - run: - name: PHPUnit - command: ./vendor/bin/simple-phpunit -c phpunit.xml --colors=always --testdox - # phpstan (needs to run after simple-phpunit, as it needs the installed phpunit) - - run: - name: PhpStan - command: ./vendor/bin/phpstan analyse --memory-limit 4G --ansi -c vendor-bin/test/vendor/becklyn/php-cs/phpstan/lib.neon src --no-interaction --no-progress - # php-coveralls (needs to run after simple-phpunit, as it needs the generated coverage-clover in build/logs/clover.xml) - - run: - name: php-coveralls - command: ./vendor/bin/php-coveralls - - # save cache at the end, to also store PHPUnit - - save_cache: - name: Save Composer Main Cache - paths: - - ./vendor - key: composer-dependencies-v2-{{ checksum "composer.json" }} - - save_cache: - name: Save Composer Bin Cache - paths: - - ./vendor-bin/test/vendor - key: composer-bin-dependencies-v2-{{ checksum "vendor-bin/test/composer.json" }} - -workflows: - version: 2 - all: - jobs: - - php: - context: CodeCov diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 17f3d67..a6089eb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1 @@ -# LTE: JZ + KE -* @apfelbox @keichinger +* @keichinger @jesko-plitt diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..c4c9a94 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,44 @@ +on: [push, pull_request] + +name: CI + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['7.4', '8.0', '8.1'] + name: PHP ${{ matrix.php-versions }} Testing + steps: + - uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl + ini-values: post_max_size=256M, max_execution_time=180 + coverage: xdebug + + - name: Composer Install + run: composer install + + - name: Composer Plugins + run: composer global require ergebnis/composer-normalize bamarni/composer-bin-plugin php-coveralls/php-coveralls --no-interaction --prefer-dist --no-progress --no-suggest --no-suggest + + - name: Composer Vendor-Bin Dependencies + run: composer bin all install --no-interaction --prefer-dist --no-progress --no-suggest + + - name: Create Build Logs Directory + run: mkdir -p build/logs + + - name: Composer Normalize + run: composer normalize --indent-size 4 --indent-style space --dry-run + + - name: PHP Cs Fixer + run: ./vendor/bin/php-cs-fixer fix --diff --config vendor-bin/test/vendor/becklyn/php-cs/.php_cs.dist.php --dry-run --no-interaction + + - name: PhpStan + run: ./vendor/bin/phpstan analyse --memory-limit 4G --ansi -c vendor-bin/test/vendor/becklyn/php-cs/phpstan/lib.neon src --no-interaction --no-progress + + - name: PhpUnit + run: ./vendor/bin/simple-phpunit -c phpunit.xml --testdox diff --git a/CHANGELOG.md b/CHANGELOG.md index 364faa5..08826a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +3.3.0 +===== + +* (feature) Add support for PHP 8. +* (internal) Fix Symfony deprecations. +* (internal) Replace CircleCI with GitHub Actions. +* (improvement) Add missing property types and return types. +* (improvement) Add support for Symfony 6. + + 3.2.2 ===== diff --git a/composer.json b/composer.json index 2470260..42d5f67 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,8 @@ { "name": "becklyn/hosting", - "type": "symfony-bundle", "description": "A symfony bundle that configures several hosting-related things.", + "license": "BSD-3-Clause", + "type": "symfony-bundle", "keywords": [ "becklyn", "hosting", @@ -9,38 +10,28 @@ "trackjs", "uptime" ], - "homepage": "https://github.com/Becklyn/Hosting", - "license": "BSD-3-Clause", "authors": [ { "name": "Becklyn Studios", "homepage": "https://becklyn.com/" } ], + "homepage": "https://github.com/Becklyn/Hosting", "require": { "php": ">=7.4", "ext-json": "*", - "becklyn/assets-bundle": "^2.6.9", - "sentry/sentry-symfony": "^4.2.3", - "symfony/cache-contracts": "^2.4.0", - "symfony/config": "^5.3.4", - "symfony/console": "^5.3.7", - "symfony/dependency-injection": "^5.3.8", - "symfony/http-kernel": "^5.3.9" + "becklyn/assets-bundle": "^2.7.1", + "sentry/sentry-symfony": "^4.2.6", + "symfony/cache-contracts": "^2.4.0 || ^3.0.0", + "symfony/config": "^5.4.3 || ^6.0.3", + "symfony/console": "^5.4.3 || ^6.0.3", + "symfony/dependency-injection": "^5.4.3 || ^6.0.3", + "symfony/http-kernel": "^5.4.4 || ^6.0.4" }, "require-dev": { - "symfony/phpunit-bridge": "^5.3.8", + "symfony/phpunit-bridge": "^5.4.3 || ^6.0.3", "twig/twig": "^2.0 || ^3.3.3" }, - "config": { - "sort-packages": true - }, - "extra": { - "branch-alias": { - "dev-master": "3.x-dev", - "dev-next": "3.x-dev" - } - }, "autoload": { "psr-4": { "Becklyn\\Hosting\\": "src/" @@ -50,5 +41,14 @@ "psr-4": { "Tests\\Becklyn\\Hosting\\": "tests/" } + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "3.x-dev", + "dev-next": "3.x-dev" + } } } diff --git a/phpstan.neon b/phpstan.neon deleted file mode 100644 index d33e92a..0000000 --- a/phpstan.neon +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - level: 4 - - reportUnmatchedIgnoredErrors: false - - excludes_analyse: - - node_modules - - tests - - vendor - - ignoreErrors: - - '#Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::#' - - '#Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface::#' - - '#Symfony\\Component\\Asset\\Packages#' diff --git a/phpunit.xml b/phpunit.xml index c2d9962..af3f147 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,37 +1,42 @@ + + + - - + - - - - - + tests - tests/fixtures - - - src/ - - + + + src + + + + + diff --git a/src/BecklynHostingBundle.php b/src/BecklynHostingBundle.php index e5867f9..5255d41 100644 --- a/src/BecklynHostingBundle.php +++ b/src/BecklynHostingBundle.php @@ -6,6 +6,7 @@ use Becklyn\Hosting\DependencyInjection\BecklynHostingExtension; use Becklyn\Hosting\DependencyInjection\CompilerPass\ConfigureSentryPass; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; use Symfony\Component\HttpKernel\Bundle\Bundle; class BecklynHostingBundle extends Bundle @@ -37,7 +38,7 @@ public function build (ContainerBuilder $container) : void /** * @inheritDoc */ - public function getContainerExtension () + public function getContainerExtension () : ?ExtensionInterface { return new BecklynHostingExtension($this->releaseVersionPass); } diff --git a/src/DependencyInjection/BecklynHostingConfiguration.php b/src/DependencyInjection/BecklynHostingConfiguration.php index c41f47c..06506be 100644 --- a/src/DependencyInjection/BecklynHostingConfiguration.php +++ b/src/DependencyInjection/BecklynHostingConfiguration.php @@ -11,7 +11,7 @@ class BecklynHostingConfiguration implements ConfigurationInterface /** * @inheritDoc */ - public function getConfigTreeBuilder () + public function getConfigTreeBuilder () : TreeBuilder { $treeBuilder = new TreeBuilder("becklyn_hosting"); diff --git a/src/Listener/MonitoringTokenListener.php b/src/Listener/MonitoringTokenListener.php index d35faf4..607e25f 100644 --- a/src/Listener/MonitoringTokenListener.php +++ b/src/Listener/MonitoringTokenListener.php @@ -9,12 +9,9 @@ class MonitoringTokenListener implements EventSubscriberInterface { - /** @var string */ - private $uptimeHtmlEmbed; + private string $uptimeHtmlEmbed; - /** - */ public function __construct (HostingConfig $config) { $this->uptimeHtmlEmbed = $config->getUptimeMonitorHtmlString(); @@ -26,7 +23,7 @@ public function __construct (HostingConfig $config) public function onResponse (ResponseEvent $event) : void { // skip if not master request - if (!$event->isMasterRequest() || null === $this->uptimeHtmlEmbed) + if (!$event->isMainRequest()) { return; } diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..b62c887 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,14 @@ +bootEnv(dirname(__DIR__) . '/.env'); +}