Skip to content

Commit d4481ae

Browse files
Merge pull request #163 from Hi-Folks/upgrade/larastan-gh-actions
Upgrading Larastan GH actions
2 parents 9503064 + 7adbc71 commit d4481ae

File tree

8 files changed

+96
-11
lines changed

8 files changed

+96
-11
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: hi-folks/ghygen
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- develop
7+
- features/**
8+
- upgrade/**
9+
10+
jobs:
11+
laravel-tests:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
operating-system: [ubuntu-latest]
17+
php-versions: [ '8.2' ]
18+
dependency-stability: [ 'prefer-none' ]
19+
20+
name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '20.x'
28+
- name: Install NPM packages
29+
run: npm i
30+
- name: Build frontend
31+
run: npm run build
32+
- name: Install PHP versions
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
php-version: ${{ matrix.php-versions }}
36+
- name: Copy .env
37+
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
38+
- name: Install Dependencies
39+
if: steps.vendor-cache.outputs.cache-hit != 'true'
40+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
41+
42+
- name: Update Dependencies with latest stable
43+
if: matrix.dependency-stability == 'prefer-stable'
44+
run: composer update --prefer-stable
45+
- name: Update Dependencies with lowest stable
46+
if: matrix.dependency-stability == 'prefer-lowest'
47+
run: composer update --prefer-stable --prefer-lowest
48+
49+
- name: Generate key
50+
run: php artisan key:generate
51+
- name: Directory Permissions
52+
run: chmod -R 777 storage bootstrap/cache
53+
- name: Run Migrations
54+
# Set environment
55+
env:
56+
SESSION_DRIVER: array
57+
DB_CONNECTION: sqlite
58+
DB_DATABASE: ":memory:"
59+
60+
run: php artisan migrate
61+
62+
- name: Show dir
63+
run: pwd
64+
- name: PHP Version
65+
run: php --version
66+
67+
# Code quality
68+
69+
- name: Execute tests (Unit and Feature tests) via PestPHP
70+
# Set environment
71+
env:
72+
SESSION_DRIVER: array
73+
DB_CONNECTION: sqlite
74+
DB_DATABASE: ":memory:"
75+
76+
run: vendor/bin/pest
77+
78+
79+
80+
- name: Execute Code Static Analysis (PHP Stan + Larastan)
81+
run: |
82+
vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress
83+
84+

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- actions/checkout@v4
1313
- actions/setup-node@v4
1414
- actions/cache@v4
15+
- Upgrading larastan usage in the Workflow
1516

1617
## 1.0.0 - 2024-03-17
1718
- Upgrading to Laravel v11

app/Console/Commands/GenerateWorkflow.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function handle()
111111
$generator->name
112112
);
113113

114-
$phpversion = Arr::get($composer, 'require.php', '8.0');
114+
$phpversion = Arr::get($composer, 'require.php', '8.3');
115115

116116
$stepPhp = $generator->detectPhpVersion($phpversion);
117117
$reportExecution->addValueInfo('PHP versions', $stepPhp);
@@ -154,7 +154,7 @@ public function handle()
154154
$reportExecution->addValueComment('Code sniffer', 'Not detected');
155155
}
156156
// nunomaduro/larastan
157-
$larastan = Arr::get($devPackages, 'nunomaduro/larastan', '');
157+
$larastan = Arr::get($devPackages, 'larastan/larastan', '');
158158
if ($larastan !== '') {
159159
$generator->stepExecuteStaticAnalysis = true;
160160
$generator->stepInstallStaticAnalysis = false;
@@ -237,7 +237,7 @@ public function handle()
237237
}
238238
if ($guesserFiles->packageExists()) {
239239
$generator->stepNodejs = true;
240-
$generator->stepNodejsVersion = '18.x';
240+
$generator->stepNodejsVersion = '20.x';
241241
$versionFromNvmrc = $generator->readNvmrc($guesserFiles
242242
->getNvmrcPath());
243243
if ($versionFromNvmrc !== '') {

app/Objects/GuesserFiles.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ private function somethingExists(string $methodPath, bool $isDirCheck = false):
190190
*/
191191
public static function detectLaravelVersionFromTestbench(string $testbenchVersion): array
192192
{
193-
$listLaravelVersions = ['6.*', '7.*', '8.*', '9.*', '10.*'];
194-
$listTestBenchVersions = ['4.0', '5.0', '6.0', '7.0', '8.0'];
193+
$listLaravelVersions = ['6.*', '7.*', '8.*', '9.*', '10.*', '11.*'];
194+
$listTestBenchVersions = ['4.0', '5.0', '6.0', '7.0', '8.0', '9.0'];
195195
$stepLaravelVersions = [];
196196
$i = 0;
197197

resources/views/action_yaml.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
run: npm ci
5151
@endif
5252
- name: Build frontend
53-
run: npm run development
53+
run: npm run build
5454
@endif
5555
- name: Install PHP versions
5656
uses: shivammathur/setup-php@v2

resources/views/yaml/code_quality.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
- name: Execute Code Static Analysis (PHP Stan + Larastan)
3232
run: |
3333
@if ($stepInstallStaticAnalysis)
34-
composer require --dev nunomaduro/larastan
34+
composer require --dev larastan/larastan
3535
@endif
3636
@if ($stepPhpstanUseNeon)
3737
vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress
3838
@else
39-
vendor/bin/phpstan analyse {{ $stepDirStaticAnalysis }} -c ./vendor/nunomaduro/larastan/extension.neon --level=4 --no-progress
39+
vendor/bin/phpstan analyse {{ $stepDirStaticAnalysis }} -c ./vendor/larastan/larastan/extension.neon --level=4 --no-progress
4040
@endif
4141
@elseif ($stepToolStaticAnalysis == 'psalmlaravel')
4242
- name: Execute Code Static Analysis (PSALM)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
- name: Execute Code Static Analysis (PHP Stan + Larastan)
22
run: |
3-
composer require --dev nunomaduro/larastan
4-
vendor/bin/phpstan analyse app -c ./vendor/nunomaduro/larastan/extension.neon --level=4 --no-progress
3+
composer require --dev larastan/larastan
4+
vendor/bin/phpstan analyse app -c ./vendor/larastan/larastan/extension.neon --level=4 --no-progress
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
- name: Execute Code Static Analysis (PHP Stan + Larastan)
22
run: |
3-
vendor/bin/phpstan analyse app -c ./vendor/nunomaduro/larastan/extension.neon --level=4 --no-progress
3+
vendor/bin/phpstan analyse app -c ./vendor/larastan/larastan/extension.neon --level=4 --no-progress

0 commit comments

Comments
 (0)