From e06991eca1ef556d156dc8d3cc622301be738832 Mon Sep 17 00:00:00 2001 From: Denis Smetannikov Date: Wed, 28 Apr 2021 16:09:09 +0300 Subject: [PATCH] Update PHP deps (#3) * Update PHP deps * Removed xDebug condition in Travis * PHP 8.0 --- .gitattributes | 11 +++ .github/workflows/main.yml | 123 ++++++++++++++++++++++++++++++++++ .phan/config.php => .phan.php | 2 +- .travis.yml | 12 +--- Makefile | 3 +- composer.json | 29 ++++---- src/EventManager.php | 2 +- tests/NamespacesTest.php | 20 +++--- 8 files changed, 163 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/main.yml rename .phan/config.php => .phan.php (87%) diff --git a/.gitattributes b/.gitattributes index cc39054..1798883 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11,4 +11,15 @@ # @link https://github.com/JBZoo/Event # +/.github export-ignore +/build export-ignore +/tests export-ignore +/.editorconfig export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.phan.php export-ignore +/.travis.yml export-ignore +/phpbench.json.dist export-ignore +/phpunit.xml.dist export-ignore + * text eol=lf diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..9620cf1 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,123 @@ +# +# JBZoo Toolbox - Event +# +# This file is part of the JBZoo Toolbox project. +# For the full copyright and license information, please view the LICENSE +# file that was distributed with this source code. +# +# @package Event +# @license MIT +# @copyright Copyright (C) JBZoo.com, All rights reserved. +# @link https://github.com/JBZoo/Event +# + +name: CI + +on: + pull_request: + branches: + - "*" + push: + branches: + - 'master' + schedule: + - cron: '40 */8 * * *' + +env: + COLUMNS: 120 + TERM_PROGRAM: Hyper + +jobs: + phpunit: + name: PHPUnit + runs-on: ubuntu-latest + strategy: + matrix: + php-version: [ 7.2, 7.3, 7.4, 8.0 ] + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: xdebug + tools: composer + + - name: Build the Project + run: make update --no-print-directory + + - name: ๐Ÿงช PHPUnit Tests + run: make test --no-print-directory + + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: PHPUnit - ${{ matrix.php-version }} - ${{ matrix.coverage }} + path: build/ + + + linters: + name: Linters + runs-on: ubuntu-latest + strategy: + matrix: + php-version: [ 7.2, 7.3, 7.4, 8.0 ] + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + tools: composer + + - name: Build the Project + run: make update --no-print-directory + + - name: ๐Ÿ‘ Code Quality + run: make codestyle --no-print-directory + + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: Linters - ${{ matrix.php-version }} + path: build/ + + + report: + name: Reports + runs-on: ubuntu-latest + strategy: + matrix: + php-version: [ 7.2, 7.3, 7.4, 8.0 ] + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: xdebug + tools: composer + + - name: Build the Project + run: make update --no-print-directory + + - name: ๐Ÿ“ Build Reports + run: make report-all --no-print-directory + + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: Reports - ${{ matrix.php-version }} + path: build/ diff --git a/.phan/config.php b/.phan.php similarity index 87% rename from .phan/config.php rename to .phan.php index 1ac86be..a380689 100644 --- a/.phan/config.php +++ b/.phan.php @@ -15,7 +15,7 @@ declare(strict_types=1); -$default = include __DIR__ . '/../vendor/jbzoo/codestyle/src/phan/default.php'; +$default = include __DIR__ . '/vendor/jbzoo/codestyle/src/phan/default.php'; $config = array_merge($default, [ 'directory_list' => [ diff --git a/.travis.yml b/.travis.yml index 6084790..137498f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,28 +15,22 @@ language: php os: linux dist: xenial +git: + depth: false + php: - 7.2 - 7.3 - 7.4 - 8.0 - - nightly - -jobs: - fast_finish: true - allow_failures: - - php: 8.0 - - php: nightly env: matrix: - JBZOO_COMPOSER_UPDATE_FLAGS="--prefer-lowest --prefer-stable" - JBZOO_COMPOSER_UPDATE_FLAGS="" - - XDEBUG_OFF="yes" before_script: - composer self-update - - if [[ $XDEBUG_OFF = yes ]]; then phpenv config-rm xdebug.ini; fi; script: - make update --no-print-directory diff --git a/Makefile b/Makefile index 171da4e..543c597 100644 --- a/Makefile +++ b/Makefile @@ -19,10 +19,9 @@ endif update: ##@Project Install/Update all 3rd party dependencies $(call title,"Install/Update all 3rd party dependencies") @echo "Composer flags: $(JBZOO_COMPOSER_UPDATE_FLAGS)" - @composer update $(JBZOO_COMPOSER_UPDATE_FLAGS) + @composer update --no-progress $(JBZOO_COMPOSER_UPDATE_FLAGS) test-all: ##@Project Run all project tests at once @make test @make codestyle - @make test-performance-travis; diff --git a/composer.json b/composer.json index 5bbda15..f46c292 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,13 @@ { - "name" : "jbzoo/event", - "type" : "library", - "description" : "Library for event-based development", - "license" : "MIT", - "keywords" : [ + "name" : "jbzoo/event", + "type" : "library", + "description" : "Library for event-based development", + "license" : "MIT", + "keywords" : [ "JBZoo", "events", "event-manager", "eventmanager", "listener", "hook", "signal", "observer", "emit", "emitter" ], - "authors" : [ + "authors" : [ { "name" : "Denis Smetannikov", "email" : "admin@jbzoo.com", @@ -20,33 +20,30 @@ } ], - "require" : { + "require" : { "php" : ">=7.2" }, - "require-dev" : { + "require-dev" : { "jbzoo/utils" : "^4.3.3", - "jbzoo/toolbox-dev" : "^2.10.0" + "jbzoo/toolbox-dev" : "^2.13.1" }, - "autoload" : { + "autoload" : { "psr-4" : { "JBZoo\\Event\\" : "src" } }, - "minimum-stability" : "dev", - "prefer-stable" : true, - - "autoload-dev" : { + "autoload-dev" : { "classmap" : ["tests"] }, - "config" : { + "config" : { "optimize-autoloader" : true }, - "extra" : { + "extra" : { "branch-alias" : { "dev-master" : "3.x-dev" } diff --git a/src/EventManager.php b/src/EventManager.php index 19df14c..803cb53 100644 --- a/src/EventManager.php +++ b/src/EventManager.php @@ -21,7 +21,7 @@ * Class EventManager * @package JBZoo\Event */ -class EventManager +final class EventManager { public const LOWEST = 0; public const LOW = 50; diff --git a/tests/NamespacesTest.php b/tests/NamespacesTest.php index 94b58af..c1a641c 100644 --- a/tests/NamespacesTest.php +++ b/tests/NamespacesTest.php @@ -59,9 +59,9 @@ public function testSimpleParts() is(1, $eManager->trigger('item.save.before')); is(1, $eManager->trigger('item.save.after')); - is(0, $eManager->trigger('undefind')); + is(0, $eManager->trigger('undefined')); is(0, $eManager->trigger('save.after')); - is(0, $eManager->trigger('item.save.undefind')); + is(0, $eManager->trigger('item.save.undefined')); is(0, $eManager->trigger('item.saved')); } @@ -75,7 +75,7 @@ public function testAnyPart() is(0, $eManager->trigger('item.save.before')); is(0, $eManager->trigger('item.save.after')); - is(0, $eManager->trigger('item.save.after.realy.deep')); + is(0, $eManager->trigger('item.save.after.really.deep')); } public function testAnyPart2() @@ -89,7 +89,7 @@ public function testAnyPart2() is(0, $eManager->trigger('item.save')); is(0, $eManager->trigger('item.save.before')); - is(0, $eManager->trigger('item.save.after.realy.deep')); + is(0, $eManager->trigger('item.save.after.really.deep')); } public function testAnyPart3() @@ -102,7 +102,7 @@ public function testAnyPart3() is(0, $eManager->trigger('item.save')); is(0, $eManager->trigger('item.save.before')); - is(0, $eManager->trigger('item.save.after.realy.deep')); + is(0, $eManager->trigger('item.save.after.really.deep')); } public function testAnyPart4() @@ -115,7 +115,7 @@ public function testAnyPart4() is(1, $eManager->trigger('item.save.after')); is(0, $eManager->trigger('item.save')); - is(0, $eManager->trigger('item.save.after.realy.deep')); + is(0, $eManager->trigger('item.save.after.really.deep')); } public function testAnyPart5() @@ -130,8 +130,8 @@ public function testAnyPart5() is(0, $eManager->trigger('item.save')); is(0, $eManager->trigger('item.save.before')); - is(0, $eManager->trigger('item.save.after.realy.deep.name')); - is(0, $eManager->trigger('item.load.after.realy.deep.name')); + is(0, $eManager->trigger('item.save.after.really.deep.name')); + is(0, $eManager->trigger('item.load.after.really.deep.name')); } public function testComplex() @@ -180,8 +180,8 @@ public function testComplex2() is(0, $eManager->trigger('item.load')); is(0, $eManager->trigger('item.load.before')); is(0, $eManager->trigger('save.before')); - is(0, $eManager->trigger('item.save.before.realy.deep.name')); - is(0, $eManager->trigger('category.save.before.realy.deep.name')); + is(0, $eManager->trigger('item.save.before.really.deep.name')); + is(0, $eManager->trigger('category.save.before.really.deep.name')); is(1, $eManager->trigger('item.save')); is(1, $eManager->trigger('category'));