diff --git a/.gitattributes b/.gitattributes index 7b69013..92d82bb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,3 +12,4 @@ /.scrutinizer.yml export-ignore /tests export-ignore /.editorconfig export-ignore +/.github export-ignore diff --git a/.github/workflows/imports.yml b/.github/workflows/imports.yml new file mode 100644 index 0000000..b89c8ea --- /dev/null +++ b/.github/workflows/imports.yml @@ -0,0 +1,36 @@ +name: Check Imports + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Check Imports + run: ./vendor/bin/check_imports diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..b5c8178 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,71 @@ +name: tests + +# Controls when the workflow will run +on: + push: + branches: [master] + pull_request: + branches: [master] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test: + # The type of runner that the job will run on + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + php: [7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3] + laravel: [^6.0, ^7.0, ^8.0, ^9.0, ^10.0] + exclude: + - php: 7.2 + laravel: ^8.0 + - php: 7.2 + laravel: ^9.0 + - php: 7.2 + laravel: ^10.0 + - php: 7.3 + laravel: ^9.0 + - php: 7.3 + laravel: ^10.0 + - php: 7.4 + laravel: ^9.0 + - php: 7.4 + laravel: ^10.0 + - php: 8.0 + laravel: ^10.0 + - php: 8.1 + laravel: ^6.0 + - php: 8.1 + laravel: ^7.0 + - php: 8.2 + laravel: ^7.0 + - php: 8.2 + laravel: ^6.0 + - php: 8.3 + laravel: ^7.0 + - php: 8.3 + laravel: ^6.0 + + name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring, exif, iconv, tokenizer + coverage: none + + - name: Install dependencies + run: | + composer require "laravel/framework=${{ matrix.laravel }}" --no-update + composer update --prefer-dist --no-interaction --no-progress + - name: Execute tests + run: ./vendor/bin/phpunit diff --git a/.styleci.yml b/.styleci.yml index 25844cc..0285f17 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -1,2 +1 @@ -php: - preset: laravel +preset: laravel diff --git a/README.md b/README.md index 6c8f9b9..48441b8 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ Quality Score [![code coverage](https://codecov.io/gh/imanghafoori1/laravel-heyman/branch/master/graph/badge.svg)](https://codecov.io/gh/imanghafoori1/laravel-heyman) [![Maintainability](https://api.codeclimate.com/v1/badges/9d6be7b057103cb14410/maintainability)](https://codeclimate.com/github/imanghafoori1/laravel-heyman/maintainability) -[![Build Status](https://travis-ci.org/imanghafoori1/laravel-heyman.svg?branch=master)](https://travis-ci.org/imanghafoori1/laravel-heyman) +[![Imports](https://github.com/imanghafoori1/laravel-heyman/actions/workflows/imports.yml/badge.svg?branch=master)](https://github.com/imanghafoori1/laravel-heyman/actions/workflows/imports.yml) +[![Test](https://github.com/imanghafoori1/laravel-heyman/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/imanghafoori1/laravel-heyman/actions/workflows/tests.yml) [![StyleCI](https://github.styleci.io/repos/139709518/shield?branch=master)](https://github.styleci.io/repos/139709518) [![Latest Stable Version](https://poser.pugx.org/imanghafoori/laravel-heyman/v/stable)](https://packagist.org/packages/imanghafoori/laravel-heyman) [![Daily Downloads](https://poser.pugx.org/imanghafoori/laravel-heyman/d/daily)](https://packagist.org/packages/imanghafoori/laravel-heyman) @@ -148,7 +149,7 @@ You are telling the framework what to do in certain situations rather than getti > — Alec Sharp ` -3- This approach is paticularly useful when you for example write a package which needs ACL but you want to allow your package users to override and apply they own ACL (or validation) rules into your package routes... +3- This approach is particularly useful when you for example write a package which needs ACL but you want to allow your package users to override and apply they own ACL (or validation) rules into your package routes... And that becomes possible when you use laravel-HeyMan for ACL. The users can easily cancel out the default rules and re-write their favorite acl or validation stuff in a regular ServiceProviders. @@ -355,7 +356,7 @@ HeyMan::whenYouHitRouteName('welcome.name') #### 5- Check points: -You can also declare some check points some where, within your application code: +You can also declare some check points somewhere, within your application code: ```php diff --git a/composer.json b/composer.json index 5098d97..9d67f1f 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,8 @@ "imanghafoori/laravel-terminator": "Gives you opportunity to refactor your controllers." }, "scripts": { - "test": "./vendor/bin/phpunit" + "test": "./vendor/bin/phpunit", + "imports": "./vendor/bin/check_imports" }, "extra": { "laravel": { diff --git a/tests/Unit/ResponderTest.php b/tests/Unit/ResponderTest.php index 2e6e954..4d5c5c9 100644 --- a/tests/Unit/ResponderTest.php +++ b/tests/Unit/ResponderTest.php @@ -2,8 +2,8 @@ namespace Imanghafoori\HeyManTests\Unit; -use Imanghafoori\HeyMan\Core\Chain; use Illuminate\Support\Str; +use Imanghafoori\HeyMan\Core\Chain; use Imanghafoori\HeyMan\Core\ChainCollection; use Imanghafoori\HeyMan\Core\Reaction; use Imanghafoori\HeyMan\Plugins\Reactions\Redirect\RedirectionMsg;