Skip to content

Commit

Permalink
ci: update all tools + run CS only on 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Mar 15, 2024
1 parent cc9549e commit bba4e43
Show file tree
Hide file tree
Showing 5 changed files with 270 additions and 463 deletions.
21 changes: 16 additions & 5 deletions .castor/qa.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,23 @@ function all(): void
}

#[AsTask(description: 'Installs tooling')]
function install(): void
function install(?string $only = null): void
{
run('composer install --working-dir tools/php-cs-fixer');
run('composer install --working-dir tools/phpstan');
run('composer install --working-dir tools/phpunit');
run('composer install --working-dir tools/rector');
$map = [
'php-cs-fixer' => fn() => run('composer install --working-dir tools/php-cs-fixer'),
'phpstan' => fn() => run('composer install --working-dir tools/phpstan'),
'phpunit' => fn() => run('composer install --working-dir tools/phpunit'),
'rector' => fn() => run('composer install --working-dir tools/rector'),
];

if ($only) {
$map = array_filter($map, fn($key) => $key === $only, ARRAY_FILTER_USE_KEY);
}

foreach ($map as $task) {
$task();
}

}

#[AsTask(description: 'Fix coding standards', aliases: ['cs'])]
Expand Down
27 changes: 23 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-versions }}"
extensions: mbstring, dom
tools: jolicode/castor

- name: Validate composer.json and composer.lock
Expand All @@ -39,11 +38,31 @@ jobs:
- name: Install quality tools
run: castor qa:install

- name: Check coding standards
run: castor qa:cs --dry-run

- name: Run PHPStan
run: castor qa:phpstan

- name: Run tests
run: castor qa:phpunit

cs:
name: Check PHP coding standards
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: jolicode/castor

- name: Install dependencies
run: castor install

- name: Install quality tools
run: castor qa:install --only php-cs-fixer

- name: Check coding standards
run: castor qa:cs --dry-run

0 comments on commit bba4e43

Please sign in to comment.