Skip to content

Commit

Permalink
Use our phpstan in the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Nov 13, 2024
1 parent e932bd2 commit 70233b4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/actions/install/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ inputs:
description: 'Install dev dependencies'
required: false
default: ''
need_phar:
description: 'Install phar dependencies'
required: false
default: 'true'

runs:
using: "composite"
Expand All @@ -28,3 +32,4 @@ runs:
run: composer install --prefer-dist --no-progress --optimize-autoloader --classmap-authoritative
shell: bash
working-directory: tools/phar
if: ${{ inputs.need_phar == 'true' }}
18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: PHP-CS-Fixer
uses: docker://ghcr.io/php-cs-fixer/php-cs-fixer:3-php8.3
- uses: ./.github/actions/install
with:
args: --config=.php-cs-fixer.php check --diff
php-version: "8.3"
need_phar: 'false'

- name: PHP CS Fixer
run: bin/castor cs

phpstan:
name: Static Analysis
Expand All @@ -41,10 +44,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: ./.github/actions/install
with:
php-version: "8.3"
need_phar: 'false'

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
env:
REQUIRE_DEV: true
run: bin/castor phpstan

phpunit:
name: "PHPUnit on ${{ matrix.php }} / Castor from ${{ matrix.castor.method }}"
Expand Down
4 changes: 4 additions & 0 deletions tools/php-cs-fixer/castor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#[AsTask(description: 'Fix CS', aliases: ['cs'])]
function cs(bool $dryRun = false): int
{
if (!file_exists(__DIR__ . '/vendor/autoload.php')) {
install();
}

$command = [
__DIR__ . '/vendor/bin/php-cs-fixer',
'fix',
Expand Down
4 changes: 4 additions & 0 deletions tools/phpstan/castor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#[AsTask(description: 'Run PHPStan', aliases: ['phpstan'])]
function phpstan(bool $generateBaseline = false): int
{
if (!file_exists(__DIR__ . '/vendor/autoload.php')) {
install();
}

$command = [
__DIR__ . '/vendor/bin/phpstan', '-v',
];
Expand Down

0 comments on commit 70233b4

Please sign in to comment.