Skip to content

Commit 3bf4836

Browse files
authored
Merge pull request #8 from MatanYadaev/improve-pipeline
Improve pipeline
2 parents 09334bf + b9a2cc1 commit 3bf4836

27 files changed

+193
-276
lines changed

.github/CONTRIBUTING.md

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/FUNDING.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/SECURITY.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/php-cs-fixer.yml

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
#name: Check & fix styling
2-
#
3-
#on: [push]
4-
#
5-
#jobs:
6-
# php-cs-fixer:
7-
# runs-on: ubuntu-latest
8-
#
9-
# steps:
10-
# - name: Checkout code
11-
# uses: actions/checkout@v2
12-
# with:
13-
# ref: ${{ github.head_ref }}
14-
#
15-
# - name: Run PHP CS Fixer
16-
# uses: docker://oskarstark/php-cs-fixer-ga
17-
# with:
18-
# args: --config=.php_cs.dist --allow-risky=yes
19-
#
20-
# - name: Commit changes
21-
# uses: stefanzweifel/git-auto-commit-action@v4
22-
# with:
23-
# commit_message: Fix styling
1+
name: Lint
2+
3+
on: [push]
4+
5+
jobs:
6+
php-cs-fixer:
7+
name: PHP CS Fixer
8+
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
15+
- name: Setup PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: 8.0
19+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
20+
coverage: none
21+
22+
- name: Install dependencies
23+
run: composer install
24+
25+
- name: Run PHP CS Fixer
26+
run: ./vendor/bin/php-cs-fixer fix --allow-risky=yes --diff --dry-run

.github/workflows/phpstan.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Static code analysis
2+
3+
on: [push]
4+
5+
jobs:
6+
phpstan:
7+
name: PHPStan
8+
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
15+
- name: Setup PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: 8.0
19+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
20+
coverage: none
21+
22+
- name: Install dependencies
23+
run: composer install --prefer-dist --no-interaction
24+
25+
- name: Run PHPStan
26+
run: ./vendor/bin/phpstan analyse --memory-limit=2G --error-format=github

.github/workflows/psalm.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/run-tests.yml

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
name: Tests
22

3-
on: [push, pull_request]
3+
on: [push]
44

55
jobs:
66
test:
7-
runs-on: ${{ matrix.os }}
8-
strategy:
9-
fail-fast: true
10-
matrix:
11-
os: [ubuntu-latest, windows-latest]
12-
php: [8.0]
13-
laravel: [8.*]
14-
stability: [prefer-lowest, prefer-stable]
15-
include:
16-
- laravel: 8.*
17-
testbench: 6.*
18-
19-
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
7+
name: PHP 8.0 - MySQL 8.0
8+
9+
runs-on: ubuntu-latest
10+
11+
services:
12+
mysql:
13+
image: mysql:8.0
14+
env:
15+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
16+
MYSQL_DATABASE: laravel_eloquent_spatial_test
17+
ports:
18+
- 3306
19+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
2020

2121
steps:
2222
- name: Checkout code
@@ -25,19 +25,14 @@ jobs:
2525
- name: Setup PHP
2626
uses: shivammathur/setup-php@v2
2727
with:
28-
php-version: ${{ matrix.php }}
28+
php-version: 8.0
2929
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
3030
coverage: none
3131

32-
- name: Setup problem matchers
33-
run: |
34-
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
35-
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
36-
3732
- name: Install dependencies
38-
run: |
39-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
40-
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
33+
run: composer install --prefer-dist --no-interaction
4134

4235
- name: Execute tests
36+
env:
37+
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
4338
run: vendor/bin/phpunit

.php_cs.dist

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,13 @@
11
<?php
22

3-
$finder = Symfony\Component\Finder\Finder::create()
4-
->notPath('bootstrap/*')
5-
->notPath('storage/*')
6-
->notPath('resources/view/mail/*')
7-
->in([
8-
__DIR__ . '/src',
9-
__DIR__ . '/tests',
10-
])
11-
->name('*.php')
12-
->notName('*.blade.php')
13-
->ignoreDotFiles(true)
14-
->ignoreVCS(true);
15-
16-
return PhpCsFixer\Config::create()
3+
return (new MattAllan\LaravelCodeStyle\Config())
4+
->setFinder(
5+
PhpCsFixer\Finder::create()
6+
->in('src')
7+
->in('tests')
8+
)
179
->setRules([
18-
'@PSR2' => true,
19-
'array_syntax' => ['syntax' => 'short'],
20-
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
21-
'no_unused_imports' => true,
22-
'not_operator_with_successor_space' => true,
23-
'trailing_comma_in_multiline_array' => true,
24-
'phpdoc_scalar' => true,
25-
'unary_operator_spaces' => true,
26-
'binary_operator_spaces' => true,
27-
'blank_line_before_statement' => [
28-
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
29-
],
30-
'phpdoc_single_line_var_spacing' => true,
31-
'phpdoc_var_without_name' => true,
32-
'class_attributes_separation' => [
33-
'elements' => [
34-
'method',
35-
],
36-
],
37-
'method_argument_space' => [
38-
'on_multiline' => 'ensure_fully_multiline',
39-
'keep_multiple_spaces_after_comma' => true,
40-
],
41-
'single_trait_insert_per_statement' => true,
10+
'@Laravel' => true,
11+
'@Laravel:risky' => true,
4212
])
43-
->setFinder($finder);
13+
->setRiskyAllowed(true);

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
},
2424
"require-dev": {
2525
"friendsofphp/php-cs-fixer": "^2.17",
26+
"matt-allan/laravel-code-style": "^0.6.0",
27+
"nunomaduro/larastan": "^0.7.0",
2628
"orchestra/testbench": "^6.0",
27-
"phpunit/phpunit": "^9.3",
28-
"psalm/plugin-laravel": "^1.4",
29-
"vimeo/psalm": "^4.3"
29+
"phpunit/phpunit": "^9.3"
3030
},
3131
"autoload": {
3232
"psr-4": {
@@ -43,7 +43,8 @@
4343
}
4444
},
4545
"scripts": {
46-
"psalm": "vendor/bin/psalm",
46+
"style-fix": "./vendor/bin/php-cs-fixer fix --allow-risky=yes",
47+
"phpstan": "vendor/bin/phpstan analyse --memory-limit=2G",
4748
"test": "vendor/bin/phpunit --colors=always",
4849
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
4950
},

0 commit comments

Comments
 (0)