Skip to content

Commit fa181dd

Browse files
committed
chore: prep laravel 11
1 parent 15b2cd1 commit fa181dd

File tree

9 files changed

+192
-14
lines changed

9 files changed

+192
-14
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 0 * * *'
8+
9+
jobs:
10+
phpunit:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
php: [8.2, 8.3]
18+
stability: [prefer-stable]
19+
20+
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v2
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php }}
30+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, memcached
31+
tools: composer:v2
32+
coverage: none
33+
34+
- name: Setup Memcached
35+
uses: niden/actions-memcached@v7
36+
37+
- name: Install dependencies
38+
uses: nick-invision/retry@v1
39+
with:
40+
timeout_minutes: 5
41+
max_attempts: 5
42+
command: COMPOSER_ROOT_VERSION=dev-master composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
43+
44+
- name: Execute tests
45+
run: vendor/bin/phpunit

.github/workflows/lock-closed-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
#issue-comment: |
1919
# This issue has been locked since it has been closed for more than 14 days.
2020
issue-lock-reason: ""
21-
process-only: "issues"
21+
process-only: "issues"

.github/workflows/pint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: PHP Linting
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
jobs:
8+
phplint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: "laravel-pint"
13+
uses: aglipanci/laravel-pint-action@2.0.0
14+
with:
15+
preset: laravel
16+
verboseMode: true
17+
- uses: stefanzweifel/git-auto-commit-action@v5
18+
with:
19+
commit_message: "fix: pint"
20+

.github/workflows/stale.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Close inactive issues
22
on:
33
schedule:
4-
- cron: "30 1 * * *"
4+
- cron: "0 0 * * *"
55

66
jobs:
77
close-issues:
@@ -12,11 +12,12 @@ jobs:
1212
steps:
1313
- uses: actions/stale@v5
1414
with:
15+
exempt-issue-labels: "bug,security,enhancement,pinned"
1516
days-before-issue-stale: 30
16-
days-before-issue-close: 14
17+
days-before-issue-close: 7
1718
stale-issue-label: "stale"
18-
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
19-
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
19+
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days."
20+
close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale."
2021
days-before-pr-stale: -1
2122
days-before-pr-close: -1
2223
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/static-analysis.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Static Analysis"
2+
3+
on:
4+
push:
5+
paths:
6+
- .github/workflows/static-analysis.yml
7+
- composer.*
8+
- phpstan.neon.dist
9+
- src/**
10+
- tests/**
11+
12+
pull_request:
13+
paths:
14+
- .github/workflows/static-analysis.yml
15+
- composer.*
16+
- phpstan.neon.dist
17+
- src/**
18+
- tests/**
19+
20+
schedule:
21+
- cron: '0 0 * * *'
22+
23+
jobs:
24+
static-analysis-phpstan:
25+
26+
name: "Static Analysis with PHPStan"
27+
runs-on: ubuntu-latest
28+
29+
strategy:
30+
fail-fast: true
31+
matrix:
32+
php: [8.2, 8.3]
33+
stability: [prefer-stable]
34+
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v2
38+
39+
- name: Setup PHP
40+
uses: shivammathur/setup-php@v2
41+
with:
42+
php-version: ${{ matrix.php }}
43+
tools: composer:v2
44+
coverage: none
45+
46+
- name: Install dependencies
47+
uses: nick-invision/retry@v1
48+
with:
49+
timeout_minutes: 5
50+
max_attempts: 5
51+
command: COMPOSER_ROOT_VERSION=dev-master composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
52+
53+
- name: "Run a static analysis with phpstan/phpstan"
54+
run: "vendor/bin/phpstan --error-format=table"

composer.json

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@
1717
}
1818
],
1919
"require": {
20-
"php": ">=7.2",
21-
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0",
22-
"illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0"
20+
"php": "^8.2",
21+
"illuminate/support": "^11.0",
22+
"illuminate/database": "^11.0"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^7.5|^8.4|^9.0|^10.0"
25+
"larastan/larastan": "^2.9.1",
26+
"laravel/pint": "^1.14",
27+
"rector/rector": "^1.0",
28+
"orchestra/testbench": "^9.0"
2629
},
2730
"autoload": {
2831
"psr-4": {
@@ -34,17 +37,32 @@
3437
"Yajra\\Auditable\\Test\\": "tests"
3538
}
3639
},
37-
"scripts": {
38-
"test": "phpunit"
39-
},
4040
"extra": {
4141
"branch-alias": {
42-
"dev-master": "4.0-dev"
42+
"dev-master": "11.x-dev"
4343
},
4444
"laravel": {
4545
"providers": [
4646
"Yajra\\Auditable\\AuditableServiceProvider"
4747
]
4848
}
49-
}
49+
},
50+
"scripts": {
51+
"test": "./vendor/bin/phpunit",
52+
"pint": "./vendor/bin/pint",
53+
"rector": "./vendor/bin/rector",
54+
"stan": "./vendor/bin/phpstan analyse --memory-limit=2G --ansi --no-progress --no-interaction --configuration=phpstan.neon.dist",
55+
"pr": [
56+
"@rector",
57+
"@pint",
58+
"@stan",
59+
"@test"
60+
]
61+
},
62+
"funding": [
63+
{
64+
"type": "github",
65+
"url": "https://github.com/sponsors/yajra"
66+
}
67+
]
5068
}

phpstan.neon.dist

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
includes:
2+
- ./vendor/larastan/larastan/extension.neon
3+
4+
parameters:
5+
6+
paths:
7+
- src
8+
9+
level: max
10+
11+
ignoreErrors:
12+
13+
excludePaths:
14+
15+
checkMissingIterableValueType: true

pint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"preset": "laravel"
3+
}

rector.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
6+
use Rector\Config\RectorConfig;
7+
use Rector\Set\ValueObject\LevelSetList;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->paths([
11+
__DIR__.'/src',
12+
__DIR__.'/tests',
13+
]);
14+
15+
// register a single rule
16+
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
17+
18+
// define sets of rules
19+
$rectorConfig->sets([
20+
LevelSetList::UP_TO_PHP_82,
21+
]);
22+
};

0 commit comments

Comments
 (0)