Skip to content

Commit 2a4af81

Browse files
authored
Merge pull request #9 from bavix/support-laravel-11
[3.0] Add support laravel ^11.0
2 parents 4117855 + 3f3f214 commit 2a4af81

33 files changed

+2061
-888
lines changed

.github/workflows/changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ jobs:
1111
permissions:
1212
contents: write
1313
secrets: inherit
14-
uses: bavix/.github/.github/workflows/changelog.yml@0.1.6
14+
uses: bavix/.github/.github/workflows/changelog.yml@0.2.4

.github/workflows/fixer.yaml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: fixer
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
autofix:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
clickhouse:
15+
image: clickhouse/clickhouse-server
16+
env:
17+
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
18+
ports:
19+
- 8123:8123
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: 8.2
29+
extensions: mbstring, pgsql, mysql, sqlite, redis, memcached, bcmath
30+
coverage: pcov
31+
env:
32+
runner: self-hosted
33+
34+
- name: Validate composer.json and composer.lock
35+
run: composer validate --strict
36+
37+
- name: Cache Composer packages
38+
id: composer-cache
39+
uses: actions/cache@v4
40+
with:
41+
path: vendor
42+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-php-
45+
46+
- name: Install dependencies
47+
run: composer install --prefer-dist --no-progress
48+
49+
- name: Run rector-fix
50+
run: composer rector-fix
51+
52+
- name: Run ecs-fix
53+
run: composer ecs-fix
54+
55+
- name: Run rector-fix
56+
run: composer rector-fix
57+
58+
- name: Run ecs-fix
59+
run: composer ecs-fix
60+
61+
- name: Run rector
62+
run: composer rector
63+
64+
- name: Run ecs
65+
run: composer ecs
66+
67+
- name: Run parabench
68+
run: composer parabench
69+
70+
- name: "Check if build has changed"
71+
if: success()
72+
id: has-changes
73+
run: |
74+
echo "stdout<<EOF" >> $GITHUB_OUTPUT
75+
echo "$(git diff --stat)" >> $GITHUB_OUTPUT
76+
echo 'EOF' >> $GITHUB_OUTPUT
77+
78+
- name: Import GPG key
79+
if: ${{ steps.has-changes.outputs.stdout }}
80+
uses: crazy-max/ghaction-import-gpg@v6
81+
with:
82+
gpg_private_key: ${{ secrets.GPG_BOT }}
83+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
84+
fingerprint: ${{ secrets.GPG_FINGERPRINT }}
85+
git_config_global: true
86+
git_user_signingkey: true
87+
git_commit_gpgsign: true
88+
git_committer_name: Github bot
89+
git_committer_email: [email protected]
90+
91+
- name: "Commit files"
92+
if: ${{ steps.has-changes.outputs.stdout }}
93+
env:
94+
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
95+
run: |
96+
gh pr checkout ${{ github.event.pull_request.number }}
97+
git commit -S -m "autofix" -a
98+
99+
- name: "Push changes"
100+
if: ${{ steps.has-changes.outputs.stdout }}
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
103+
run: git push -u origin HEAD

.github/workflows/phpstan.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: phpstan
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
phpstan:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: 8.2
21+
22+
- name: Validate composer.json and composer.lock
23+
run: composer validate --strict
24+
25+
- name: Cache Composer packages
26+
id: composer-cache
27+
uses: actions/cache@v4
28+
with:
29+
path: vendor
30+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-php-
33+
34+
- name: Install dependencies
35+
run: composer install --prefer-dist --no-progress
36+
37+
- name: Run phpstan
38+
run: composer phpstan

.github/workflows/phpunits.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: phpunits
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
units:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
php-versions: [8.2, 8.3]
16+
laravel-versions: [^10.0, ^11.0]
17+
18+
services:
19+
clickhouse:
20+
image: clickhouse/clickhouse-server
21+
env:
22+
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
23+
ports:
24+
- 8123:8123
25+
26+
steps:
27+
- name: Checkout
28+
id: git-checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Setup PHP
32+
id: php-install
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
php-version: ${{ matrix.php-versions }}
36+
extensions: mbstring, pgsql, mysql, sqlite, redis, memcached
37+
coverage: pcov
38+
39+
- name: Validate composer.json and composer.lock
40+
id: composer-validate
41+
run: composer validate --strict
42+
43+
- name: Cache Composer packages
44+
id: composer-cache
45+
uses: actions/cache@v4
46+
with:
47+
path: vendor
48+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
49+
restore-keys: |
50+
${{ runner.os }}-php-
51+
52+
- name: Install dependencies
53+
id: composer-dependencies
54+
run: composer req --dev laravel/framework:${{ matrix.laravel-versions }} -W || composer install
55+
56+
- name: Check codeclimate
57+
id: codeclimate-check
58+
run: echo "execute=${{ matrix.php-versions == '8.2' && matrix.caches == 'array' && matrix.databases == 'testing' }}" >> $GITHUB_OUTPUT
59+
60+
- name: Prepare codeclimate
61+
id: codeclimate-prepare
62+
run: |
63+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
64+
chmod +x ./cc-test-reporter
65+
./cc-test-reporter before-build
66+
if: ${{ steps.codeclimate-check.outputs.execute == 'true' }}
67+
68+
- name: Prepare run test suite
69+
id: unit-prepare
70+
run: |
71+
mkdir build
72+
73+
- name: Run test suite
74+
id: unit-run
75+
run: composer parabench
76+
77+
- name: Send coverage
78+
id: codeclimate-send
79+
run: |
80+
./cc-test-reporter after-build --coverage-input-type clover --exit-code 0
81+
bash <(curl -s https://codecov.io/bash)
82+
env:
83+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
84+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
85+
if: ${{ steps.codeclimate-check.outputs.execute == 'true' }}

.github/workflows/stale.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Mark stale issues
2+
on:
3+
schedule:
4+
- cron: "0 0 * * *"
5+
jobs:
6+
stale:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/stale@v9
10+
with:
11+
repo-token: ${{ secrets.GITHUB_TOKEN }}
12+
stale-issue-message: 'This issue is stale because it has been open 21 days with no activity.'
13+
days-before-stale: 21
14+
days-before-close: 3

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
/vendor
2-
/.idea
1+
composer.phar
2+
/vendor/
33
composer.lock
4-
tests/coverage
4+
.idea/
5+
build/
6+
.phpunit.result.cache
7+
.php_cs_cache
8+
.phpunit.cache/

.travis.yml

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

composer.json

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,24 @@
99
"eloquent"
1010
],
1111
"require": {
12-
"php": "^7.2|^8.0",
13-
"laravel/framework": "^6.0|^7.0|^8.0|^9.0|^10.0",
14-
"the-tinderbox/clickhouse-builder": "^4.0|^5.0|^6.0",
12+
"php": "^8.2",
13+
"laravel/framework": "^10.0|^11.0",
14+
"the-tinderbox/clickhouse-builder": "^6.1",
1515
"ext-json": "*"
1616
},
1717
"require-dev": {
18-
"infection/infection": "~0.15",
19-
"phpunit/phpunit": "^8.0|^9.0",
20-
"mockery/mockery": "^1.3",
21-
"fakerphp/faker": "^1.9",
22-
"bavix/clickhouse-php-client": "^3.0",
23-
"bavix/clickhouse-builder": "^4.0"
18+
"driftingly/rector-laravel": "^1.0",
19+
"ergebnis/phpstan-rules": "^2.1",
20+
"infection/infection": "~0.27",
21+
"larastan/larastan": "^2.8",
22+
"nunomaduro/collision": "^8.0",
23+
"orchestra/testbench": "^9.0",
24+
"phpstan/phpstan": "^1.10",
25+
"phpunit/phpunit": "^10.5",
26+
"rector/rector": "^1.0",
27+
"symplify/easy-coding-standard": "^12.1",
28+
"mockery/mockery": "^1.6",
29+
"fakerphp/faker": "^1.23"
2430
},
2531
"autoload": {
2632
"psr-4": {
@@ -40,6 +46,19 @@
4046
}
4147
},
4248
"scripts": {
43-
"test": "vendor/bin/phpunit --stop-on-failure tests/"
49+
"parabench":"@php ./vendor/bin/testbench package:test --coverage-xml=build/coverage-xml --log-junit=build/junit.xml",
50+
"infect": "@php vendor/bin/infection --coverage=build --min-msi=50 -j$(nproc) --only-covering-test-cases",
51+
"phpstan": "@php vendor/bin/phpstan analyse -vvv --memory-limit 2G -c phpstan.neon",
52+
"phpstan-baseline": "@php vendor/bin/phpstan analyse -vvv --memory-limit 2G -c phpstan.neon --generate-baseline phpstan.baseline.neon",
53+
"ecs": "@php vendor/bin/ecs check",
54+
"ecs-fix": "@php vendor/bin/ecs check --fix",
55+
"ecs-cc": "@php vendor/bin/ecs --clear-cache",
56+
"rector": "@php vendor/bin/rector process --dry-run",
57+
"rector-fix": "@php vendor/bin/rector process"
58+
},
59+
"config": {
60+
"allow-plugins": {
61+
"infection/extension-installer": true
62+
}
4463
}
4564
}

ecs.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer;
6+
use Symplify\EasyCodingStandard\Config\ECSConfig;
7+
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
8+
9+
return static function (ECSConfig $config): void {
10+
$config->paths([
11+
__DIR__ . '/src',
12+
__DIR__ . '/tests',
13+
]);
14+
15+
$config->skip([
16+
GeneralPhpdocAnnotationRemoveFixer::class,
17+
]);
18+
19+
$config->sets([
20+
SetList::CLEAN_CODE,
21+
SetList::SYMPLIFY,
22+
SetList::ARRAY,
23+
SetList::COMMON,
24+
SetList::PSR_12,
25+
SetList::CONTROL_STRUCTURES,
26+
SetList::NAMESPACES,
27+
SetList::STRICT,
28+
SetList::PHPUNIT,
29+
SetList::LARAVEL,
30+
]);
31+
};

0 commit comments

Comments
 (0)