Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Nov 21, 2024
2 parents a1be14a + 2e47d11 commit ed01f4b
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 35 deletions.
24 changes: 7 additions & 17 deletions .github/workflows/analyse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,15 @@ on:

jobs:
analyse:
runs-on: ${{ matrix.os }}
runs-on: "ubuntu-latest"
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
os:
- "ubuntu-latest"
php:
- 8.3
dependencies:
- "highest"
php: [8.3]
experimental:
- false

name: PHP${{ matrix.php }} PHPStan & Pint
name: PHP:${{ matrix.php }} Code Analysis

steps:
- name: Checkout code
Expand All @@ -36,23 +31,18 @@ jobs:
- name: Install dependencies
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"
dependency-versions: "highest"
composer-options: "--prefer-dist --no-cache"

- name: Execute Static Code Analysis
run: vendor/bin/phpstan analyse

lint:
runs-on: ${{ matrix.os }}
runs-on: "ubuntu-latest"
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
os:
- "ubuntu-latest"
php:
- 8.3
dependencies:
- "highest"
php: [8.3]
experimental:
- false

Expand All @@ -72,7 +62,7 @@ jobs:
- name: Install dependencies
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"
dependency-versions: "highest"
composer-options: "--prefer-dist --no-cache"

- name: PHP Lint
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/audits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@ on:

jobs:
audit-dependencies:
runs-on: ${{ matrix.os }}
runs-on: "ubuntu-latest"
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
os:
- "ubuntu-latest"
php:
- 8.2
- 8.3
- 8.4
experimental:
- true

name: PHP${{ matrix.php }} on ${{ matrix.os }}
name: PHP:${{ matrix.php }} Code Audit

steps:
- name: Checkout code
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/coveralls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@ on:

jobs:
tests:
runs-on: ${{ matrix.os }}
runs-on: "ubuntu-latest"
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
os:
- "ubuntu-latest"
php:
- 8.3
dependencies:
- "highest"
php: [8.3]
experimental:
- false

name: PHP${{ matrix.php }} on ${{ matrix.os }} (${{ matrix.dependencies }})
name: PHP:${{ matrix.php }} Code Coverage

steps:
- name: Checkout code
Expand All @@ -35,7 +30,7 @@ jobs:
- name: Install dependencies
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"
dependency-versions: "highest"
composer-options: "--prefer-dist --no-cache"

- name: Execute tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
experimental:
- false

name: PHP${{ matrix.php }} on ${{ matrix.os }} (${{ matrix.dependencies }})
name: PHP:${{ matrix.php }} / OS:${{ matrix.os }} ${{ matrix.dependencies == 'highest' && '⬆️' || '⬇️' }}

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-stubs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, intl, fileinfo, :php-psr
coverage: none

Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"illuminate/support": "^11.31",
"orchestra/canvas-core": "^9.0",
"orchestra/testbench-core": "^9.2",
"symfony/polyfill-php83": "^1.30",
"symfony/polyfill-php83": "^1.31",
"symfony/yaml": "^7.0.3"
},
"require-dev": {
Expand Down Expand Up @@ -76,7 +76,10 @@
"@php vendor/bin/pint",
"@php vendor/bin/phpstan analyse --verbose"
],
"test": "@php vendor/bin/phpunit --no-configuration --color ./tests ./workbench/tests",
"test": [
"@composer dump-autoload",
"@php vendor/bin/phpunit --no-coverage --no-configuration --bootstrap vendor/autoload.php --color ./tests ./workbench/tests"
],
"ci": [
"@composer audit",
"@prepare",
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ parameters:
level: 8

ignoreErrors:
# - identifier: missingType.generics
- identifier: missingType.iterableValue

treatPhpDocTypesAsCertain: false
4 changes: 4 additions & 0 deletions src/Console/PresetMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
use function Laravel\Prompts\select;
use function Orchestra\Testbench\package_path;

/**
* @codeCoverageIgnore
*/
#[AsCommand(name: 'preset', description: 'Create canvas.yaml for the project')]
class PresetMakeCommand extends GeneratorCommand
{
Expand Down Expand Up @@ -78,6 +81,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
*
* @return string
*/
#[\Override]
protected function getStub()
{
$name = Str::lower($this->getNameInput());
Expand Down
6 changes: 5 additions & 1 deletion src/Console/TestMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Orchestra\Canvas\Console;

use Illuminate\Support\Str;
use Illuminate\Filesystem\Filesystem;
use Orchestra\Canvas\Core\Concerns\CodeGenerator;
use Orchestra\Canvas\Core\Concerns\UsesGeneratorOverrides;
use Orchestra\Canvas\GeneratorPreset;
Expand Down Expand Up @@ -78,7 +79,7 @@ protected function replaceTestCase(string $stub, string $testCase): string
{
$namespaceTestCase = $testCase = str_replace('/', '\\', $testCase);

if (Str::startsWith($testCase, '\\')) {
if (str_starts_with($testCase, '\\')) {
$stub = str_replace('NamespacedDummyTestCase', trim($testCase, '\\'), $stub);
} else {
$stub = str_replace('NamespacedDummyTestCase', $namespaceTestCase, $stub);
Expand All @@ -99,6 +100,7 @@ protected function replaceTestCase(string $stub, string $testCase): string
* @param string $stub
* @return string
*/
#[\Override]
protected function resolveStubPath($stub)
{
$preset = $this->generatorPreset();
Expand Down Expand Up @@ -137,6 +139,7 @@ protected function getGeneratorSourcePath(): string
* @param string $name
* @return string
*/
#[\Override]
protected function getPath($name)
{
return $this->getPathUsingCanvas($name);
Expand All @@ -147,6 +150,7 @@ protected function getPath($name)
*
* @return string
*/
#[\Override]
protected function rootNamespace()
{
return $this->generatorPreset()->testingNamespace();
Expand Down
1 change: 1 addition & 0 deletions src/Console/UserFactoryMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class UserFactoryMakeCommand extends GeneratorCommand
*
* @return string
*/
#[\Override]
protected function getStub()
{
return $this->resolveStubPath(join_paths('stubs', 'user-factory.stub'));
Expand Down
1 change: 1 addition & 0 deletions src/Console/UserModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ protected function buildClass($name)
*
* @return string
*/
#[\Override]
protected function getStub()
{
return $this->resolveStubPath(join_paths('stubs', 'user-model.stub'));
Expand Down

0 comments on commit ed01f4b

Please sign in to comment.