Skip to content

Commit c60d6c1

Browse files
committed
add actions
1 parent 523cc0b commit c60d6c1

File tree

5 files changed

+143
-1
lines changed

5 files changed

+143
-1
lines changed

.github/workflows/analyse.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: analyse
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
phpstan:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: 8.1
21+
22+
- name: Get Composer Cache Directory
23+
id: composer-cache
24+
run: |
25+
echo "::set-output name=dir::$(composer config cache-files-dir)"
26+
27+
- uses: actions/cache@v3
28+
with:
29+
path: ${{ steps.composer-cache.outputs.dir }}
30+
key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-composer-8.1
33+
34+
- name: Install dependencies
35+
if: steps.cache-descom-laravel-auth.outputs.cache-hit != 'true'
36+
run: |
37+
composer install
38+
composer dump
39+
40+
- name: Run analyse phpstan
41+
run: vendor/bin/phpstan analyse --error-format github

.github/workflows/style-fix.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: style-fix
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
style:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Setup PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: 8.1
19+
20+
- name: Get Composer Cache Directory
21+
id: composer-cache
22+
run: |
23+
echo "::set-output name=dir::$(composer config cache-files-dir)"
24+
25+
- uses: actions/cache@v3
26+
with:
27+
path: ${{ steps.composer-cache.outputs.dir }}
28+
key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
29+
restore-keys: |
30+
${{ runner.os }}-composer-8.1
31+
32+
- name: Install dependencies
33+
if: steps.cache-descom-laravel-auth.outputs.cache-hit != 'true'
34+
run: |
35+
composer install
36+
composer dump
37+
38+
- name: Fix styles
39+
run: vendor/bin/php-cs-fixer fix
40+
41+
- uses: EndBug/add-and-commit@v9
42+
43+
- name: Run style
44+
run: vendor/bin/php-cs-fixer fix --dry-run --diff --format junit

.php-cs-fixer.dist.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->in([
5+
__DIR__.'/src',
6+
__DIR__.'/tests',
7+
])
8+
->name('*.php')
9+
->notName('*.blade.php')
10+
->ignoreDotFiles(true)
11+
->ignoreVCS(true);
12+
13+
return (new PhpCsFixer\Config())
14+
->setRules([
15+
'@PSR12' => true,
16+
'array_syntax' => ['syntax' => 'short'],
17+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
18+
'no_unused_imports' => true,
19+
'not_operator_with_successor_space' => true,
20+
'trailing_comma_in_multiline' => true,
21+
'phpdoc_scalar' => true,
22+
'unary_operator_spaces' => true,
23+
'binary_operator_spaces' => true,
24+
'blank_line_before_statement' => [
25+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
26+
],
27+
'phpdoc_single_line_var_spacing' => true,
28+
'phpdoc_var_without_name' => true,
29+
'class_attributes_separation' => [
30+
'elements' => [
31+
'method' => 'one',
32+
],
33+
],
34+
'method_argument_space' => [
35+
'on_multiline' => 'ensure_fully_multiline',
36+
'keep_multiple_spaces_after_comma' => true,
37+
],
38+
'single_trait_insert_per_statement' => true,
39+
'php_unit_method_casing' => ['case' => 'camel_case'],
40+
])
41+
->setFinder($finder);

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
"guzzlehttp/psr7": "^1",
3333
"omnipay/tests": "^4.1",
3434
"phpunit/phpunit": "^9.5",
35-
"orchestra/testbench": "^7.0"
35+
"orchestra/testbench": "^7.0",
36+
"friendsofphp/php-cs-fixer": "^3.10",
37+
"phpstan/phpstan": "^1.8",
38+
"nunomaduro/larastan": "^2.1"
3639
},
3740
"extra": {
3841
"laravel": {

phpstan.neon.dist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
includes:
2+
- ./vendor/nunomaduro/larastan/extension.neon
3+
4+
parameters:
5+
6+
paths:
7+
- src
8+
- tests
9+
10+
# The level 9 is the highest level
11+
level: 5
12+
13+
checkMissingIterableValueType: false

0 commit comments

Comments
 (0)