Skip to content

Commit

Permalink
feat: upload phpstan errors as artifact (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulredmond authored Jul 17, 2023
1 parent 4a19854 commit 12caaad
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions .github/workflows/php-stan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,35 @@ on:
required: false
type: string
default: "8.2"
command:
description: "The command to run to for phpstan"
required: false
type: string
default: "composer phpstan"
error_file:
description: "The path to the error file to capture phpstan JSON errors"
required: false
type: string
default: "phpstan-errors.json"
artifact_name:
description: "The name of the phpstan artifact"
required: false
type: string
default: "phpstan-errors"
secrets:
packagist_username:
required: true
packagist_password:
required: true

jobs:
php-cs-fixer:
phpstan:
runs-on: ubuntu-latest
name: PHPStan
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -35,20 +51,18 @@ jobs:
}
}
}
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer install --prefer-dist --no-interaction --no-progress
- name: Install composer dependencies
uses: ramsey/composer-install@v2

- name: Run PHPStan
run: composer phpstan
run: ${{ inputs.command }}
env:
PHPSTAN_ERROR_FILE: ${{ inputs.error_file }}

- name: phpstan errors artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact_name }}
path: ${{ inputs.error_file }}

0 comments on commit 12caaad

Please sign in to comment.