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 4f9f47f
Show file tree
Hide file tree
Showing 10 changed files with 306 additions and 466 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
28 changes: 23 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
- "8.1"
- "8.2"
- "8.3"

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -27,7 +26,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 +37,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
6 changes: 6 additions & 0 deletions tools/php-cs-fixer/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"require": {
"friendsofphp/php-cs-fixer": "^3.19"
},
"config": {
"platform": {
"php": "8.1"
},
"sort-packages": true
}
}

0 comments on commit 4f9f47f

Please sign in to comment.