Skip to content

Commit d990674

Browse files
Merge pull request #116 from Hi-Folks/develop
v0.4.3
2 parents 8d0802f + 059b6cd commit d990674

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2176
-1751
lines changed

.github/workflows/auto-generated-workflow.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
branches:
55
- main
66
- develop
7-
- features/**
87

98
jobs:
109
laravel-tests:
@@ -32,7 +31,7 @@ jobs:
3231
matrix:
3332
operating-system: [ubuntu-latest]
3433
php-versions: [ '7.4','8.0' ]
35-
dependency-stability: [ prefer-stable ]
34+
dependency-stability: [ 'prefer-stable' ]
3635

3736
name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
3837

@@ -93,7 +92,7 @@ jobs:
9392
9493
- name: Execute Code Static Analysis (PHP Stan + Larastan)
9594
run: |
96-
vendor/bin/phpstan analyse app -c ./vendor/nunomaduro/larastan/extension.neon --level=4 --no-progress
95+
vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress
9796
9897
9998
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# GithHub Actions Workflow generated with Ghygen
2+
# Original configuration: http://gh-actions-yaml-generator.test?code=598d9be9c7539d79c6fc033ff98593d7
3+
name: dependency stability
4+
on:
5+
push:
6+
branches:
7+
- features/add_stability_level_options
8+
9+
jobs:
10+
laravel-tests:
11+
runs-on: ubuntu-latest
12+
# Service container Mysql mysql
13+
services:
14+
# Label used to access the service container
15+
mysql:
16+
# Docker Hub image (also with version)
17+
image: mysql:5.7
18+
env:
19+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
20+
MYSQL_DATABASE: db_test_laravel
21+
## map the "external" 33306 port with the "internal" 3306
22+
ports:
23+
- 33306:3306
24+
# Set health checks to wait until mysql database has started (it takes some seconds to start)
25+
options: >-
26+
--health-cmd="mysqladmin ping"
27+
--health-interval=10s
28+
--health-timeout=5s
29+
--health-retries=3
30+
31+
strategy:
32+
matrix:
33+
operating-system: [ubuntu-latest]
34+
php-versions: [ '8.0','7.4' ]
35+
dependency-stability: [ 'prefer-none','prefer-stable','prefer-lowest' ]
36+
37+
name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
38+
39+
steps:
40+
- uses: actions/checkout@v2
41+
- name: Setup Node.js
42+
uses: actions/setup-node@v1
43+
with:
44+
node-version: '16.x'
45+
- name: Install NPM packages
46+
run: npm ci
47+
- name: Build frontend
48+
run: npm run development
49+
- name: Install PHP versions
50+
uses: shivammathur/setup-php@v2
51+
with:
52+
php-version: ${{ matrix.php-versions }}
53+
- name: Copy .env
54+
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
55+
- name: Install Dependencies
56+
if: steps.vendor-cache.outputs.cache-hit != 'true'
57+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
58+
59+
- name: Update Dependencies with latest stable
60+
if: matrix.dependency-stability == 'prefer-stable'
61+
run: composer update --prefer-stable
62+
- name: Update Dependencies with lowest stable
63+
if: matrix.dependency-stability == 'prefer-lowest'
64+
run: composer update --prefer-stable --prefer-lowest
65+
66+
- name: Generate key
67+
run: php artisan key:generate
68+
- name: Directory Permissions
69+
run: chmod -R 777 storage bootstrap/cache
70+
- name: Run Migrations
71+
# Set environment
72+
env:
73+
DB_CONNECTION: mysql
74+
DB_DATABASE: db_test_laravel
75+
DB_PORT: 33306
76+
DB_USER: root
77+
78+
run: php artisan migrate
79+
80+
- name: Show dir
81+
run: pwd
82+
- name: PHP Version
83+
run: php --version
84+
85+
# Code quality
86+
- name: Execute tests (Unit and Feature tests) via PHPUnit
87+
# Set environment
88+
env:
89+
DB_CONNECTION: mysql
90+
DB_DATABASE: db_test_laravel
91+
DB_PORT: 33306
92+
DB_USER: root
93+
94+
run: vendor/bin/phpunit --testdox

.github/workflows/psalm-sarif.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# GithHub Actions Workflow generated with Ghygen
2+
# Original configuration: https://ghygen.hi-folks.dev?code=134510bb699cebfb255e85ec60955d59
3+
name: Code Scanning - GitHub integration
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- develop
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.0','7.4' ]
18+
dependency-stability: [ prefer-stable ]
19+
20+
name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Install PHP versions
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php-versions }}
28+
- name: Copy .env
29+
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
30+
- name: Install Dependencies
31+
if: steps.vendor-cache.outputs.cache-hit != 'true'
32+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
33+
34+
- name: Generate key
35+
run: php artisan key:generate
36+
37+
- name: Show dir
38+
run: pwd
39+
- name: PHP Version
40+
run: php --version
41+
42+
# Code quality
43+
44+
45+
46+
- name: Execute Code Static Analysis (PSALM)
47+
run: |
48+
vendor/bin/psalm --report=result.sarif
49+
- name: Upload SARIF file
50+
uses: github/codeql-action/upload-sarif@v1
51+
with:
52+
# Path to SARIF file relative to the root of the repository
53+
sarif_file: result.sarif

.github/workflows/codequality-php8-featuresbranch.yml renamed to .github/workflows/test-codequality-php8-featuresbranch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Ghygen (Mysql) Quality Code PHP 8
44
on:
55
push:
66
branches:
7-
- features/**
7+
- tests/**
88

99
jobs:
1010
laravel-tests:

.github/workflows/codequality-phpversions.yml renamed to .github/workflows/test-codequality-phpversions.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ name: Ghygen (Mysql) Quality Code PHP 8,7
44
on:
55
push:
66
branches:
7-
- main
8-
- develop
7+
- tests/**
98

109
jobs:
1110
laravel-tests:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# Changelog
2+
3+
## 0.4.3 - 2021-10-19
4+
It is still Hacktoberfest!
5+
- Psalm, create Sarif report for GitHub code scanning integration
6+
- update to Alpinejs 3
7+
- Allow user to set dependency stability (none, the latest stable, the lowest stable), thanks to @marulitua
8+
- Phpstan Level 6 (from 5 to 6, report missing typehints)
9+
210
## 0.4.2 - 2021-10-12
311
Hacktoberfest, goes on...
412
- Updated Cover image

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ __Ghygen__ allows you creating your __Yaml__ file for __GitHub Actions__, for La
2323
- run migrations;
2424
- __execute tests__ via phpunit;
2525
- __execute tests__ via PestPHP;
26-
- static __code analysis__ with phpstan or psalm;
26+
- static __code analysis__ with phpstan or psalm;
27+
- create Sarif report (with Psalm) for __GitHub integration with code scanning__;
2728
- code sniffer (via phpcs for __PSR12__ compatibility);
2829
- __validate Yaml__ file;
2930
- execute __Browser Test__ via Laravel Dusk.

app/Console/Commands/GenerateWorkflow.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class GenerateWorkflow extends Command
1919
{--projectdir= : the directory of the project with composer.json}
2020
{--cache : enable caching packages in the workflow}
2121
{--envfile=' . GuesserFiles::ENV_DEFAULT_TEMPLATE_FILE . ' : the .env file to use in the workflow}
22+
{--prefer-stable : Prefer stable versions of dependencies}
23+
{--prefer-lowest : Prefer lowest versions of dependencies}
2224
';
2325

2426

@@ -70,6 +72,15 @@ public function handle()
7072
$generator->name = Arr::get($composer, 'name');
7173
$phpversion = Arr::get($composer, 'require.php', "");
7274
$generator->detectPhpVersion($phpversion);
75+
if ($this->option("prefer-stable") && $this->option("prefer-lowest")) {
76+
$generator->dependencyStability = [ 'prefer-stable', 'prefer-lowest' ];
77+
} elseif ($this->option("prefer-lowest")) {
78+
$generator->dependencyStability = [ 'prefer-lowest' ];
79+
} elseif ($this->option("prefer-stable")) {
80+
$generator->dependencyStability = [ 'prefer-stable' ];
81+
} else {
82+
$generator->dependencyStability = [ 'prefer-none' ];
83+
}
7384

7485
// detect packages
7586
$devPackages = Arr::get($composer, 'require-dev');

app/Console/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Kernel extends ConsoleKernel
1010
/**
1111
* The Artisan commands provided by your application.
1212
*
13-
* @var array
13+
* @var array<mixed>
1414
*/
1515
protected $commands = [
1616
//

app/Exceptions/Handler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Handler extends ExceptionHandler
1010
/**
1111
* A list of the exception types that are not reported.
1212
*
13-
* @var array
13+
* @var array<mixed>
1414
*/
1515
protected $dontReport = [
1616
//
@@ -19,7 +19,7 @@ class Handler extends ExceptionHandler
1919
/**
2020
* A list of the inputs that are never flashed for validation exceptions.
2121
*
22-
* @var array
22+
* @var array<string>
2323
*/
2424
protected $dontFlash = [
2525
'password',

app/Http/Kernel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Kernel extends HttpKernel
1111
*
1212
* These middleware are run during every request to your application.
1313
*
14-
* @var array
14+
* @var array<mixed>
1515
*/
1616
protected $middleware = [
1717
// \App\Http\Middleware\TrustHosts::class,
@@ -26,7 +26,7 @@ class Kernel extends HttpKernel
2626
/**
2727
* The application's route middleware groups.
2828
*
29-
* @var array
29+
* @var array<mixed>
3030
*/
3131
protected $middlewareGroups = [
3232
'web' => [
@@ -50,7 +50,7 @@ class Kernel extends HttpKernel
5050
*
5151
* These middleware may be assigned to groups or used individually.
5252
*
53-
* @var array
53+
* @var array<mixed>
5454
*/
5555
protected $routeMiddleware = [
5656
'auth' => \App\Http\Middleware\Authenticate::class,

app/Http/Livewire/ConfiguratorForm.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,29 @@ class ConfiguratorForm extends Component
3434
use LaravelStuff;
3535
use Deploy;
3636

37-
public $code = "";
38-
public $template = "";
37+
public string $code = "";
38+
public string $template = "";
3939

40+
/**
41+
* @var array<mixed>
42+
*/
4043
protected $queryString = [
4144
'code' => ['except' => ''],
4245
'template' => ['except' => '']
4346
];
4447

4548

46-
public $result;
47-
public $errorGeneration;
49+
public string $result;
50+
public string $errorGeneration;
4851

52+
/**
53+
* @var array<mixed>
54+
*/
4955
public $hints;
5056

57+
/**
58+
* @var array<mixed>
59+
*/
5160
protected $rules = [
5261
'name' => 'required|string',
5362
'onPushBranches' => 'exclude_unless:onPush,1|required',
@@ -74,7 +83,7 @@ private function loadDefaults(): void
7483
}
7584

7685

77-
private function loadFromJson($j): void
86+
private function loadFromJson(object $j): void
7887
{
7988
$this->loadBaseWorkflowFromJson($j);
8089
$this->loadCodeQualityFromJson($j);
@@ -112,13 +121,13 @@ public function mount(): void
112121

113122

114123

115-
public function updated($propertyName): void
124+
public function updated(string $propertyName): void
116125
{
117126
$this->result = " ";
118127
}
119128

120129

121-
public function template($x): void
130+
public function template(string $x): void
122131
{
123132
if (in_array($x, ["laravelapp", "laravelpostgresql", "laravelpackage", "phppackage"])) {
124133
$this->template = $x;

app/Http/Livewire/Dashboard/Daily.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
class Daily extends Component
1111
{
12+
/**
13+
* @var \Illuminate\Support\Collection $daily
14+
*/
1215
public $daily;
1316

1417
public function mount(): void

app/Http/Livewire/Dashboard/Latest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
class Latest extends Component
99
{
10+
/**
11+
* @var mixed $latest
12+
*/
1013
public $latest;
1114

1215
public function mount(): void

app/Http/Livewire/Dashboard/Metrics.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
class Metrics extends Component
1010
{
11-
public $count;
12-
public $total;
13-
public $last4hours;
14-
public $last24hours;
15-
public $last3days;
11+
public int $count;
12+
public int $total;
13+
public int $last4hours;
14+
public int $last24hours;
15+
public int $last3days;
1616

1717
public function mount(): void
1818
{

0 commit comments

Comments
 (0)