diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03092587..b3e8d050 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,9 +6,8 @@ jobs: strategy: matrix: container: [ - "kirschbaumdevelopment/laravel-test-runner:7.3", - "kirschbaumdevelopment/laravel-test-runner:7.4", - "kirschbaumdevelopment/laravel-test-runner:8.0" + "kirschbaumdevelopment/laravel-test-runner:8.2", + "kirschbaumdevelopment/laravel-test-runner:8.3" ] container: @@ -39,7 +38,7 @@ jobs: options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install composer dependencies run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - name: Run Testsuite against MySQL @@ -53,4 +52,4 @@ jobs: env: DB_CONNECTION: pgsql DB_HOST: postgres - DB_PORT: 5432 \ No newline at end of file + DB_PORT: 5432 diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 38eac6d1..9e34ec0c 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,20 +1,29 @@ name: Format [PHP] -on: [push] +on: + pull_request: + paths: + - '**.php' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true jobs: php-cs-fixer: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: - ref: ${{ github.head_ref }} + ref: ${{ github.event.pull_request.head.ref }} - name: Run php-cs-fixer - uses: docker://oskarstark/php-cs-fixer-ga + uses: docker://oskarstark/php-cs-fixer-ga:3.13.0 with: - args: --config=.php-cs-fixer.php + args: --config=.php-cs-fixer.dist.php + - uses: stefanzweifel/git-auto-commit-action@v4 with: commit_message: Apply php-cs-fixer changes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 00000000..72b74ce0 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,55 @@ +exclude('vendor') + ->exclude('node_modules') + ->exclude('bower_components') + ->exclude('public') + ->exclude('bootstrap') + ->exclude('resources') + ->exclude('storage') + ->in(__DIR__) + ->name('*.php') + ->notName('*.blade.php'); + +$config = new PhpCsFixer\Config(); + +return $config + ->setRules([ + '@PSR12' => true, + 'array_syntax' => ['syntax' => 'short'], + 'ordered_imports' => [ + 'imports_order' => [ + 'class', + 'function', + 'const' + ], + 'sort_algorithm' => 'alpha' + ], + 'no_unused_imports' => true, + 'no_empty_statement' => true, + 'no_useless_return' => true, + 'not_operator_with_successor_space' => true, + 'explicit_string_variable' => true, + 'simple_to_complex_string_variable' => true, + 'array_indentation' => true, + 'blank_line_before_statement' => [ + 'statements' => [ + 'case', + 'default', + 'declare', + 'do', + 'goto', + 'if', + 'include', + 'include_once', + 'require', + 'require_once', + 'switch', + 'try', + ] + ], + ]) + ->setFinder($finder); diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php deleted file mode 100644 index b0159582..00000000 --- a/.php-cs-fixer.php +++ /dev/null @@ -1,20 +0,0 @@ -notPath('node_modules') - ->notPath('vendor') - ->notPath('public') - ->notPath('resources') - ->in(__DIR__) - ->name('*.php') - ->notName('*.blade.php'); - -$config = new PhpCsFixer\Config(); - -return $config->setRules([ - '@PSR2' => true, - 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sort_algorithm' => 'alpha'], - 'no_unused_imports' => true, - ]) - ->setFinder($finder);