Skip to content

Commit d6708fb

Browse files
committed
Add workflows: Phpstan, formatting and tests
1 parent 6f622db commit d6708fb

8 files changed

+305
-19
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Fix PHP code style issues
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
php-code-styling:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.head_ref }}
21+
22+
- name: Fix PHP code style issues
23+
uses: aglipanci/[email protected]
24+
25+
- name: Commit changes
26+
uses: stefanzweifel/git-auto-commit-action@v5
27+
with:
28+
commit_message: Fix styling

.github/workflows/phpstan.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: PHPStan
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'phpstan.neon.dist'
8+
- '.github/workflows/phpstan.yml'
9+
10+
jobs:
11+
phpstan:
12+
name: phpstan
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: '8.1'
22+
coverage: none
23+
24+
- name: Install composer dependencies
25+
uses: ramsey/composer-install@v2
26+
27+
- name: Run PHPStan
28+
run: ./vendor/bin/phpstan --error-format=github

.github/workflows/run-tests.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: run-tests
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- '.github/workflows/run-tests.yml'
8+
- 'phpunit.xml.dist'
9+
- 'composer.json'
10+
- 'composer.lock'
11+
12+
jobs:
13+
test:
14+
runs-on: ${{ matrix.os }}
15+
timeout-minutes: 5
16+
strategy:
17+
fail-fast: true
18+
matrix:
19+
os: [ubuntu-latest, windows-latest]
20+
php: [8.3, 8.2, 8.1]
21+
laravel: [10.*]
22+
stability: [prefer-lowest, prefer-stable]
23+
include:
24+
- laravel: 10.*
25+
testbench: 8.*
26+
carbon: ^2.63
27+
28+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Setup PHP
35+
uses: shivammathur/setup-php@v2
36+
with:
37+
php-version: ${{ matrix.php }}
38+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
39+
coverage: none
40+
41+
- name: Setup problem matchers
42+
run: |
43+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
44+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
45+
46+
- name: Install dependencies
47+
run: |
48+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
49+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
50+
51+
- name: List Installed Dependencies
52+
run: composer show -D
53+
54+
- name: Execute tests
55+
run: vendor/bin/pest --ci

composer.json

+24-8
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,29 @@
1717
],
1818
"require": {
1919
"php": "^8.1",
20-
"spatie/laravel-package-tools": "^1.14.0",
21-
"filament/filament": "^3.0.9",
2220
"bacon/bacon-qr-code": "^2.0",
23-
"pragmarx/google2fa": "^7.0|^8.0"
21+
"filament/filament": "^3.0.9",
22+
"illuminate/contracts": "^10.0",
23+
"pragmarx/google2fa": "^7.0|^8.0",
24+
"spatie/laravel-package-tools": "^1.14.0"
2425
},
2526
"require-dev": {
2627
"laravel/pint": "^1.0",
2728
"nunomaduro/collision": "^7.9",
28-
"orchestra/testbench": "^8.0",
29-
"pestphp/pest": "^2.0",
29+
"larastan/larastan": "^2.0.1",
30+
"orchestra/testbench": "^8.8",
31+
"pestphp/pest": "^2.20",
3032
"pestphp/pest-plugin-arch": "^2.0",
3133
"pestphp/pest-plugin-laravel": "^2.0",
34+
"pestphp/pest-plugin-livewire": "^2.1",
35+
"phpstan/extension-installer": "^1.1",
36+
"phpstan/phpstan-deprecation-rules": "^1.0",
37+
"phpstan/phpstan-phpunit": "^1.0",
3238
"spatie/laravel-ray": "^1.26"
3339
},
3440
"autoload": {
3541
"psr-4": {
36-
"Jeffgreco13\\FilamentBreezy\\": "src/",
37-
"Jeffgreco13\\FilamentBreezy\\Database\\Factories\\": "database/factories/"
42+
"Jeffgreco13\\FilamentBreezy\\": "src/"
3843
}
3944
},
4045
"autoload-dev": {
@@ -43,7 +48,18 @@
4348
}
4449
},
4550
"scripts": {
46-
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
51+
"post-autoload-dump": "@composer run prepare",
52+
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
53+
"prepare": "@php vendor/bin/testbench package:discover --ansi",
54+
"build": [
55+
"@composer run prepare",
56+
"@php vendor/bin/testbench workbench:build --ansi"
57+
],
58+
"start": [
59+
"Composer\\Config::disableProcessTimeout",
60+
"@composer run build",
61+
"@php vendor/bin/testbench serve"
62+
],
4763
"analyse": "vendor/bin/phpstan analyse",
4864
"test": "vendor/bin/pest",
4965
"test-coverage": "vendor/bin/pest --coverage",

phpstan-baseline.neon

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Access to an undefined property Illuminate\\\\Contracts\\\\Auth\\\\Authenticatable\\:\\:\\$two_factor_secret\\.$#"
5+
count: 1
6+
path: src/BreezyCore.php
7+
8+
-
9+
message: "#^Access to an undefined property Jeffgreco13\\\\FilamentBreezy\\\\Livewire\\\\MyProfileComponent\\:\\:\\$view\\.$#"
10+
count: 1
11+
path: src/Livewire/MyProfileComponent.php
12+
13+
-
14+
message: "#^Access to an undefined property Jeffgreco13\\\\FilamentBreezy\\\\Livewire\\\\PersonalInfo\\:\\:\\$form\\.$#"
15+
count: 2
16+
path: src/Livewire/PersonalInfo.php
17+
18+
-
19+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:getAvatarUploadComponent\\(\\)\\.$#"
20+
count: 2
21+
path: src/Livewire/PersonalInfo.php
22+
23+
-
24+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:hasAvatars\\(\\)\\.$#"
25+
count: 1
26+
path: src/Livewire/PersonalInfo.php
27+
28+
-
29+
message: "#^Access to static property \\$personalAccessTokenModel on an unknown class Laravel\\\\Sanctum\\\\Sanctum\\.$#"
30+
count: 1
31+
path: src/Livewire/SanctumTokens.php
32+
33+
-
34+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:getSanctumPermissions\\(\\)\\.$#"
35+
count: 1
36+
path: src/Livewire/SanctumTokens.php
37+
38+
-
39+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:getTwoFactorQrCodeSvg\\(\\)\\.$#"
40+
count: 1
41+
path: src/Livewire/TwoFactorAuthentication.php
42+
43+
-
44+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:shouldForceTwoFactor\\(\\)\\.$#"
45+
count: 1
46+
path: src/Livewire/TwoFactorAuthentication.php
47+
48+
-
49+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:verify\\(\\)\\.$#"
50+
count: 1
51+
path: src/Livewire/TwoFactorAuthentication.php
52+
53+
-
54+
message: "#^Access to an undefined property Jeffgreco13\\\\FilamentBreezy\\\\Livewire\\\\UpdatePassword\\:\\:\\$form\\.$#"
55+
count: 1
56+
path: src/Livewire/UpdatePassword.php
57+
58+
-
59+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:getPasswordUpdateRequiresCurrent\\(\\)\\.$#"
60+
count: 1
61+
path: src/Livewire/UpdatePassword.php
62+
63+
-
64+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:getPasswordUpdateRules\\(\\)\\.$#"
65+
count: 1
66+
path: src/Livewire/UpdatePassword.php
67+
68+
-
69+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:shouldForceTwoFactor\\(\\)\\.$#"
70+
count: 1
71+
path: src/Middleware/MustTwoFactor.php
72+
73+
-
74+
message: "#^Call to an undefined method Illuminate\\\\Foundation\\\\Auth\\\\User\\:\\:hasConfirmedTwoFactor\\(\\)\\.$#"
75+
count: 1
76+
path: src/Middleware/MustTwoFactor.php
77+
78+
-
79+
message: "#^Call to an undefined method Illuminate\\\\Foundation\\\\Auth\\\\User\\:\\:hasValidTwoFactorSession\\(\\)\\.$#"
80+
count: 1
81+
path: src/Middleware/MustTwoFactor.php
82+
83+
-
84+
message: "#^Access to an undefined property Jeffgreco13\\\\FilamentBreezy\\\\Models\\\\BreezySession\\:\\:\\$authenticatable\\.$#"
85+
count: 1
86+
path: src/Models/BreezySession.php
87+
88+
-
89+
message: "#^Access to an undefined property Jeffgreco13\\\\FilamentBreezy\\\\Models\\\\BreezySession\\:\\:\\$two_factor_confirmed_at\\.$#"
90+
count: 1
91+
path: src/Models/BreezySession.php
92+
93+
-
94+
message: "#^Access to an undefined property Jeffgreco13\\\\FilamentBreezy\\\\Models\\\\BreezySession\\:\\:\\$two_factor_secret\\.$#"
95+
count: 2
96+
path: src/Models/BreezySession.php
97+
98+
-
99+
message: "#^Property 'expires_at' does not exist in Jeffgreco13\\\\FilamentBreezy\\\\Models\\\\BreezySession model\\.$#"
100+
count: 1
101+
path: src/Models/BreezySession.php
102+
103+
-
104+
message: "#^Property 'two_factor_confirmed_at' does not exist in Jeffgreco13\\\\FilamentBreezy\\\\Models\\\\BreezySession model\\.$#"
105+
count: 1
106+
path: src/Models/BreezySession.php
107+
108+
-
109+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:getNavigationGroup\\(\\)\\.$#"
110+
count: 1
111+
path: src/Pages/MyProfilePage.php
112+
113+
-
114+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:getRegisteredMyProfileComponents\\(\\)\\.$#"
115+
count: 1
116+
path: src/Pages/MyProfilePage.php
117+
118+
-
119+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:shouldRegisterNavigation\\(\\)\\.$#"
120+
count: 1
121+
path: src/Pages/MyProfilePage.php
122+
123+
-
124+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:slug\\(\\)\\.$#"
125+
count: 1
126+
path: src/Pages/MyProfilePage.php
127+
128+
-
129+
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
130+
count: 1
131+
path: src/Pages/MyProfilePage.php
132+
133+
-
134+
message: "#^Access to an undefined property Illuminate\\\\Foundation\\\\Auth\\\\User\\:\\:\\$two_factor_recovery_codes\\.$#"
135+
count: 1
136+
path: src/Pages/TwoFactorPage.php
137+
138+
-
139+
message: "#^Access to an undefined property Jeffgreco13\\\\FilamentBreezy\\\\Pages\\\\TwoFactorPage\\:\\:\\$form\\.$#"
140+
count: 1
141+
path: src/Pages/TwoFactorPage.php
142+
143+
-
144+
message: "#^Call to an undefined method Filament\\\\Contracts\\\\Plugin\\|Filament\\\\FilamentManager\\:\\:verify\\(\\)\\.$#"
145+
count: 1
146+
path: src/Pages/TwoFactorPage.php
147+
148+
-
149+
message: "#^Call to an undefined method Illuminate\\\\Foundation\\\\Auth\\\\User\\:\\:hasValidTwoFactorSession\\(\\)\\.$#"
150+
count: 1
151+
path: src/Pages/TwoFactorPage.php
152+
153+
-
154+
message: "#^Call to an undefined method Illuminate\\\\Foundation\\\\Auth\\\\User\\:\\:setTwoFactorSession\\(\\)\\.$#"
155+
count: 1
156+
path: src/Pages/TwoFactorPage.php
157+
158+
-
159+
message: "#^Method Jeffgreco13\\\\FilamentBreezy\\\\Pages\\\\TwoFactorPage\\:\\:getFormActions\\(\\) has invalid return type Jeffgreco13\\\\FilamentBreezy\\\\Pages\\\\ActionGroup\\.$#"
160+
count: 1
161+
path: src/Pages/TwoFactorPage.php

phpstan.neon.dist

-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ parameters:
55
level: 4
66
paths:
77
- src
8-
- config
98
- database
109
tmpDir: build/phpstan
1110
checkOctaneCompatibility: true
1211
checkModelProperties: true
1312
checkMissingIterableValueType: false
14-

phpunit.xml.dist

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
55
backupGlobals="false"
6-
backupStaticAttributes="false"
76
bootstrap="vendor/autoload.php"
87
colors="true"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="true"
11-
convertWarningsToExceptions="true"
128
processIsolation="false"
139
stopOnFailure="false"
1410
executionOrder="random"
1511
failOnWarning="true"
1612
failOnRisky="true"
1713
failOnEmptyTestSuite="true"
1814
beStrictAboutOutputDuringTests="true"
19-
verbose="true"
15+
cacheDirectory=".phpunit.cache"
16+
backupStaticProperties="false"
2017
>
2118
<testsuites>
2219
<testsuite name="Jeffgreco13 Test Suite">
2320
<directory>tests</directory>
2421
</testsuite>
2522
</testsuites>
2623
<coverage>
27-
<include>
28-
<directory suffix=".php">./src</directory>
29-
</include>
3024
<report>
3125
<html outputDirectory="build/coverage"/>
3226
<text outputFile="build/coverage.txt"/>
@@ -36,4 +30,9 @@
3630
<logging>
3731
<junit outputFile="build/report.junit.xml"/>
3832
</logging>
33+
<source>
34+
<include>
35+
<directory suffix=".php">./src</directory>
36+
</include>
37+
</source>
3938
</phpunit>

tests/TestCase.php

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Jeffgreco13\FilamentBreezy\Tests;
44

5+
use Filament\FilamentServiceProvider;
56
use Illuminate\Database\Eloquent\Factories\Factory;
67
use Jeffgreco13\FilamentBreezy\FilamentBreezyServiceProvider;
78
use Livewire\LivewireServiceProvider;

0 commit comments

Comments
 (0)