diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 27bcee3f..937faadd 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,3 +1,4 @@ +# See https://github.com/release-drafter/release-drafter#configuration template: | ## What’s Changed diff --git a/.github/workflows/bundler.yml b/.github/workflows/bundler.yml new file mode 100644 index 00000000..107fac9c --- /dev/null +++ b/.github/workflows/bundler.yml @@ -0,0 +1,43 @@ +name: Bundler + +on: create + +jobs: + autocommit: + name: Update to stable dependencies + if: startsWith(github.ref, 'refs/heads/release/') + runs-on: ubuntu-latest + container: + image: atk4/image:latest # https://github.com/atk4/image + steps: + - uses: actions/checkout@master + - run: echo ${{ github.ref }} + - name: Update to stable dependencies + run: | + # replaces X keys with X-release keys + jq '. as $in | reduce (keys_unsorted[] | select(endswith("-release")|not)) as $k ({}; . + {($k) : (($k + "-release") as $kr | $in | if has($kr) then .[$kr] else .[$k] end) } )' < composer.json > tmp && mv tmp composer.json + v=$(echo ${{ github.ref }} | cut -d / -f 4) + echo "::set-env name=version::$v" + + - uses: teaminkling/autocommit@master + with: + commit-message: Setting release dependencies + - uses: ad-m/github-push-action@master + with: + branch: ${{ github.ref }} + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: pull-request + uses: romaninsh/pull-request@master + with: + source_branch: "release/${{ env.version }}" + destination_branch: "master" # If blank, default: master + pr_title: "Releasing ${{ env.version }} into master" + pr_body: | + - [ ] Review changes (must include stable dependencies) + - [ ] Merge this PR into master (will delete ${{ github.ref }}) + - [ ] Go to Releases and create TAG from master + Do not merge master into develop + pr_reviewer: "romaninsh" + pr_assignee: "romaninsh" + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 59fb9817..68fcd9a7 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -11,6 +11,6 @@ jobs: runs-on: ubuntu-latest steps: # Drafts your next Release notes as Pull Requests are merged into "master" - - uses: toolmantim/release-drafter@v5.2.0 + - uses: toolmantim/release-drafter@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 3284891b..cf671a36 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,7 +1,12 @@ name: Unit Testing on: - pull_request + pull_request: + branches: '*' + push: + branches: + - master + - develop jobs: unit-test: diff --git a/README.md b/README.md index 29e71132..13834f9f 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,11 @@ **Collection of PHP Traits for designing object-oriented frameworks.** -[![Build Status](https://travis-ci.org/atk4/core.png?branch=develop)](https://travis-ci.org/atk4/core) +![Build](https://github.com/atk4/core/workflows/Unit%20Testing/badge.svg) [![Code Climate](https://codeclimate.com/github/atk4/core/badges/gpa.svg)](https://codeclimate.com/github/atk4/core) [![StyleCI](https://styleci.io/repos/57242416/shield)](https://styleci.io/repos/57242416) [![CodeCov](https://codecov.io/gh/atk4/core/branch/develop/graph/badge.svg)](https://codecov.io/gh/atk4/core) [![Test Coverage](https://codeclimate.com/github/atk4/core/badges/coverage.svg)](https://codeclimate.com/github/atk4/core/coverage) -[![Issue Count](https://codeclimate.com/github/atk4/core/badges/issue_count.svg)](https://codeclimate.com/github/atk4/core) - -[![License](https://poser.pugx.org/atk4/core/license)](https://packagist.org/packages/atk4/core) [![GitHub release](https://img.shields.io/github/release/atk4/core.svg?maxAge=2592000)](CHANGELOG.md) diff --git a/composer.json b/composer.json index a32f3948..7fde8761 100644 --- a/composer.json +++ b/composer.json @@ -1,42 +1,51 @@ { - "name": "atk4/core", - "type": "library", - "description": "Agile Core - collection of PHP Traits for designing object-oriented frameworks", - "keywords": ["php", "framework", "trains", "agile toolkit"], - "homepage": "https://github.com/atk4/core", - "license": "MIT", - "minimum-stability": "dev", - "prefer-stable": true, - "authors": [ - { - "name": "Romans Malinovskis", - "email": "romans@agiletoolkit.org", - "homepage": "https://nearly.guru/" - } - ], - "require": { - "php": ">=7.2.0", - "psr/log": "~1.0", - "ext-json": "*" - }, - "require-dev": { - "phpunit/phpunit": "*", - "symfony/yaml": "~2.1|~3.0|~4.0", - "satooshi/php-coveralls": "^1.0", - "codeclimate/php-test-reporter": "*", - "symfony/contracts": "^1.1", - "atk4/data": "dev-develop" - }, - "replace": { - "atk4/core": "self.version" - }, - "suggest": { - "symfony/yaml": "~2.1|~3.0|~4.0" - }, - "autoload": { - "psr-4": {"atk4\\core\\":"src/"} - }, - "autoload-dev": { - "psr-4": {"atk4\\core\\tests\\":"tests/"} + "name": "atk4/core", + "type": "library", + "description": "Agile Core - collection of PHP Traits for designing object-oriented frameworks", + "keywords": [ + "php", + "framework", + "traits", + "agile toolkit" + ], + "homepage": "https://github.com/atk4/core", + "license": "MIT", + "minimum-stability": "dev", + "prefer-stable": true, + "authors": [ + { + "name": "Romans Malinovskis", + "email": "romans@agiletoolkit.org", + "homepage": "https://nearly.guru/" } + ], + "require": { + "php": ">=7.2.0", + "psr/log": "~1.0", + "ext-json": "*" + }, + "require-dev": { + "phpunit/phpunit": "*", + "symfony/yaml": "~2.1|~3.0|~4.0", + "satooshi/php-coveralls": "^1.0", + "codeclimate/php-test-reporter": "*", + "symfony/contracts": "^1.1", + "atk4/data": "^2.0" + }, + "replace": { + "atk4/core": "self.version" + }, + "suggest": { + "symfony/yaml": "~2.1|~3.0|~4.0" + }, + "autoload": { + "psr-4": { + "atk4\\core\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "atk4\\core\\tests\\": "tests/" + } + } } diff --git a/src/CollectionTrait.php b/src/CollectionTrait.php index 6635277b..ca62b6cc 100644 --- a/src/CollectionTrait.php +++ b/src/CollectionTrait.php @@ -54,7 +54,7 @@ public function _addIntoCollection(string $name, object $object, string $collect 'Object with requested name already exist in collection', 'name' => $name, 'collection'=> $collection, - ]); + ]); } $this->{$collection}[$name] = $object; diff --git a/src/ConfigTrait.php b/src/ConfigTrait.php index d01bc028..6bec6f97 100644 --- a/src/ConfigTrait.php +++ b/src/ConfigTrait.php @@ -94,7 +94,7 @@ public function readConfig($files = ['config.php'], $format = 'php') $configs[] = $tempConfig; } - $this->config = array_merge_recursive($this->config, ...$configs); + $this->config = array_replace_recursive($this->config, ...$configs); return $this; } diff --git a/src/DynamicMethodTrait.php b/src/DynamicMethodTrait.php index 75e30308..ecc67edb 100644 --- a/src/DynamicMethodTrait.php +++ b/src/DynamicMethodTrait.php @@ -30,10 +30,10 @@ public function __call(string $method, $arguments) throw new Exception([ 'Method '.$method.' is not defined for this object', - 'class' => get_class($this), - 'method' => $method, - 'arguments' => $arguments, - ]); + 'class' => get_class($this), + 'method' => $method, + 'arguments' => $arguments, + ]); } /**