Skip to content

Commit 5bd3e68

Browse files
committed
create workflow
1 parent ef79b22 commit 5bd3e68

File tree

6 files changed

+86
-6
lines changed

6 files changed

+86
-6
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
ci:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Cache Composer packages
21+
id: composer-cache
22+
uses: actions/cache@v3
23+
with:
24+
path: vendor
25+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.json') }}
26+
restore-keys: |
27+
${{ runner.os }}-php-
28+
29+
- name: Install dependencies
30+
run: composer install --prefer-dist --no-progress
31+
32+
- name: Run ci checks
33+
run: composer ci

composer.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@
1616
}
1717
},
1818
"scripts": {
19+
"lint": "XDEBUG_MODE=off pint --test",
20+
"lint.fix": "XDEBUG_MODE=off pint",
21+
"stan": "XDEBUG_MODE=off phpstan analyse --ansi --memory-limit=-1",
22+
"test.arch": "XDEBUG_MODE=off pest --testsuite=Architecture",
23+
"test.unit": "XDEBUG_MODE=off pest --testsuite=Unit",
24+
"test.feature": "XDEBUG_MODE=coverage pest --testsuite=Feature --coverage --min=90",
25+
"rector": "XDEBUG_MODE=off rector process --dry-run",
26+
"rector.fix": "XDEBUG_MODE=off rector process",
27+
"ci": [
28+
"@lint",
29+
"@stan",
30+
"@rector",
31+
"@test.arch",
32+
"@test.unit",
33+
"@test.feature"
34+
],
35+
"ci.fix": [
36+
"@rector.fix",
37+
"@lint.fix"
38+
]
1939
},
2040
"extra": {
2141
"laravel": {

phpstan.neon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
includes:
2+
- vendor/larastan/larastan/extension.neon
3+
- vendor/nesbot/carbon/extension.neon
4+
5+
parameters:
6+
7+
paths:
8+
- src/
9+
10+
level: max

rector.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
7+
return RectorConfig::configure()
8+
->withPaths([
9+
__DIR__.'/config',
10+
__DIR__.'/src',
11+
])
12+
// uncomment to reach your current PHP version
13+
// ->withPhpSets()
14+
->withTypeCoverageLevel(0)
15+
->withDeadCodeLevel(0)
16+
->withCodeQualityLevel(0);

src/CodebuddyServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ public function provides()
3131
Configure::class,
3232
];
3333
}
34-
}
34+
}

src/Commands/Configure.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Illuminate\Console\Command;
66
use Illuminate\Filesystem\Filesystem;
7-
use function Termwind\render;
87

98
class Configure extends Command
109
{
@@ -14,7 +13,7 @@ class Configure extends Command
1413

1514
public function handle(): void
1615
{
17-
$filesystem = new Filesystem();
16+
$filesystem = new Filesystem;
1817

1918
$configs = [
2019
'rector.php',
@@ -23,18 +22,20 @@ public function handle(): void
2322
];
2423

2524
foreach ($configs as $file) {
26-
$sourceFile = __DIR__ . "/../../config/laravel/{$file}";
25+
$sourceFile = __DIR__."/../../config/laravel/{$file}";
2726
$destinationFile = base_path($file);
2827

29-
if (!$filesystem->exists($sourceFile)) {
28+
if (! $filesystem->exists($sourceFile)) {
3029
$this->error("Source file not found: {$sourceFile}");
30+
3131
continue;
3232
}
3333

3434
if ($filesystem->exists($destinationFile)) {
3535
$overwrite = $this->confirmOverwrite($destinationFile);
36-
if (!$overwrite) {
36+
if (! $overwrite) {
3737
$this->warn("Skipped: {$destinationFile} already exists");
38+
3839
continue;
3940
}
4041
}

0 commit comments

Comments
 (0)