Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use our phpstan in the CI #565

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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