diff --git a/.github/workflows/hi_folksghygen-20240317-214618.yml b/.github/workflows/hi_folksghygen-20240317-214618.yml new file mode 100644 index 0000000..eed53a9 --- /dev/null +++ b/.github/workflows/hi_folksghygen-20240317-214618.yml @@ -0,0 +1,84 @@ +name: hi-folks/ghygen +on: + push: + branches: + - main + - develop + - features/** + - upgrade/** + +jobs: + laravel-tests: + runs-on: ubuntu-latest + + strategy: + matrix: + operating-system: [ubuntu-latest] + php-versions: [ '8.2' ] + dependency-stability: [ 'prefer-none' ] + + name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}} + + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + - name: Install NPM packages + run: npm i + - name: Build frontend + run: npm run build + - name: Install PHP versions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.example', '.env');" + - name: Install Dependencies + if: steps.vendor-cache.outputs.cache-hit != 'true' + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + + - name: Update Dependencies with latest stable + if: matrix.dependency-stability == 'prefer-stable' + run: composer update --prefer-stable + - name: Update Dependencies with lowest stable + if: matrix.dependency-stability == 'prefer-lowest' + run: composer update --prefer-stable --prefer-lowest + + - name: Generate key + run: php artisan key:generate + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + - name: Run Migrations +# Set environment + env: + SESSION_DRIVER: array + DB_CONNECTION: sqlite + DB_DATABASE: ":memory:" + + run: php artisan migrate + + - name: Show dir + run: pwd + - name: PHP Version + run: php --version + +# Code quality + + - name: Execute tests (Unit and Feature tests) via PestPHP +# Set environment + env: + SESSION_DRIVER: array + DB_CONNECTION: sqlite + DB_DATABASE: ":memory:" + + run: vendor/bin/pest + + + + - name: Execute Code Static Analysis (PHP Stan + Larastan) + run: | + vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dd1cdd..57114cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - actions/checkout@v4 - actions/setup-node@v4 - actions/cache@v4 +- Upgrading larastan usage in the Workflow ## 1.0.0 - 2024-03-17 - Upgrading to Laravel v11 diff --git a/app/Console/Commands/GenerateWorkflow.php b/app/Console/Commands/GenerateWorkflow.php index 14319e1..5e524b0 100644 --- a/app/Console/Commands/GenerateWorkflow.php +++ b/app/Console/Commands/GenerateWorkflow.php @@ -111,7 +111,7 @@ public function handle() $generator->name ); - $phpversion = Arr::get($composer, 'require.php', '8.0'); + $phpversion = Arr::get($composer, 'require.php', '8.3'); $stepPhp = $generator->detectPhpVersion($phpversion); $reportExecution->addValueInfo('PHP versions', $stepPhp); @@ -154,7 +154,7 @@ public function handle() $reportExecution->addValueComment('Code sniffer', 'Not detected'); } // nunomaduro/larastan - $larastan = Arr::get($devPackages, 'nunomaduro/larastan', ''); + $larastan = Arr::get($devPackages, 'larastan/larastan', ''); if ($larastan !== '') { $generator->stepExecuteStaticAnalysis = true; $generator->stepInstallStaticAnalysis = false; @@ -237,7 +237,7 @@ public function handle() } if ($guesserFiles->packageExists()) { $generator->stepNodejs = true; - $generator->stepNodejsVersion = '18.x'; + $generator->stepNodejsVersion = '20.x'; $versionFromNvmrc = $generator->readNvmrc($guesserFiles ->getNvmrcPath()); if ($versionFromNvmrc !== '') { diff --git a/app/Objects/GuesserFiles.php b/app/Objects/GuesserFiles.php index 9347694..9d30015 100644 --- a/app/Objects/GuesserFiles.php +++ b/app/Objects/GuesserFiles.php @@ -190,8 +190,8 @@ private function somethingExists(string $methodPath, bool $isDirCheck = false): */ public static function detectLaravelVersionFromTestbench(string $testbenchVersion): array { - $listLaravelVersions = ['6.*', '7.*', '8.*', '9.*', '10.*']; - $listTestBenchVersions = ['4.0', '5.0', '6.0', '7.0', '8.0']; + $listLaravelVersions = ['6.*', '7.*', '8.*', '9.*', '10.*', '11.*']; + $listTestBenchVersions = ['4.0', '5.0', '6.0', '7.0', '8.0', '9.0']; $stepLaravelVersions = []; $i = 0; diff --git a/resources/views/action_yaml.blade.php b/resources/views/action_yaml.blade.php index 154e63f..8f71520 100644 --- a/resources/views/action_yaml.blade.php +++ b/resources/views/action_yaml.blade.php @@ -50,7 +50,7 @@ run: npm ci @endif - name: Build frontend - run: npm run development + run: npm run build @endif - name: Install PHP versions uses: shivammathur/setup-php@v2 diff --git a/resources/views/yaml/code_quality.blade.php b/resources/views/yaml/code_quality.blade.php index 1e9a27d..6904232 100644 --- a/resources/views/yaml/code_quality.blade.php +++ b/resources/views/yaml/code_quality.blade.php @@ -31,12 +31,12 @@ - name: Execute Code Static Analysis (PHP Stan + Larastan) run: | @if ($stepInstallStaticAnalysis) - composer require --dev nunomaduro/larastan + composer require --dev larastan/larastan @endif @if ($stepPhpstanUseNeon) vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress @else - vendor/bin/phpstan analyse {{ $stepDirStaticAnalysis }} -c ./vendor/nunomaduro/larastan/extension.neon --level=4 --no-progress + vendor/bin/phpstan analyse {{ $stepDirStaticAnalysis }} -c ./vendor/larastan/larastan/extension.neon --level=4 --no-progress @endif @elseif ($stepToolStaticAnalysis == 'psalmlaravel') - name: Execute Code Static Analysis (PSALM) diff --git a/tests/Feature/mock-asserts/phpstan-install.yaml b/tests/Feature/mock-asserts/phpstan-install.yaml index 90e1506..98b175d 100644 --- a/tests/Feature/mock-asserts/phpstan-install.yaml +++ b/tests/Feature/mock-asserts/phpstan-install.yaml @@ -1,4 +1,4 @@ - name: Execute Code Static Analysis (PHP Stan + Larastan) run: | - composer require --dev nunomaduro/larastan - vendor/bin/phpstan analyse app -c ./vendor/nunomaduro/larastan/extension.neon --level=4 --no-progress + composer require --dev larastan/larastan + vendor/bin/phpstan analyse app -c ./vendor/larastan/larastan/extension.neon --level=4 --no-progress diff --git a/tests/Feature/mock-asserts/phpstan-noinstall.yaml b/tests/Feature/mock-asserts/phpstan-noinstall.yaml index 1f04ac4..dacb9d7 100644 --- a/tests/Feature/mock-asserts/phpstan-noinstall.yaml +++ b/tests/Feature/mock-asserts/phpstan-noinstall.yaml @@ -1,3 +1,3 @@ - name: Execute Code Static Analysis (PHP Stan + Larastan) run: | - vendor/bin/phpstan analyse app -c ./vendor/nunomaduro/larastan/extension.neon --level=4 --no-progress + vendor/bin/phpstan analyse app -c ./vendor/larastan/larastan/extension.neon --level=4 --no-progress