Created
February 7, 2025 14:10
-
-
Save trovster/095b67cd1f98e1a1b4d2ae4b98e03b01 to your computer and use it in GitHub Desktop.
My GrumPHP and Workflow tasks for code style.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Style & Static Analysis | |
on: | |
push: | |
branches: | |
- develop | |
- feature/* | |
workflow_dispatch: | |
jobs: | |
phpstan: | |
name: Static Analysis - PHP ${{ matrix.php }} - ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
php: [8.2] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: none | |
tools: composer, phpstan, phpcs | |
- name: Install composer dependencies | |
run: | | |
composer update --prefer-dist --no-interaction --no-interaction --no-scripts | |
- name: List installed dependencies | |
run: composer show -D | |
- name: Run PHPStan | |
run: ./vendor/bin/phpstan --error-format=github | |
phpcs: | |
name: PHP Code Style - PHP ${{ matrix.php }} - ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
php: [8.2] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: none | |
tools: composer, phpcs | |
- name: Install composer dependencies | |
run: | | |
composer update --prefer-dist --no-interaction --no-interaction --no-scripts | |
- name: List installed dependencies | |
run: composer show -D | |
- name: Run PHP Code Sniffer | |
run: ./vendor/bin/phpcs -s | |
insights: | |
name: PHP Insights - PHP ${{ matrix.php }} - ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
php: [8.2] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: none | |
tools: composer | |
- name: Install composer dependencies | |
run: | | |
composer update --prefer-dist --no-interaction --no-interaction --no-scripts | |
- name: List installed dependencies | |
run: composer show -D | |
- name: Run PHP Insights | |
run: ./vendor/bin/phpinsights analyse --no-interaction --disable-security-check -n --ansi --format=github-action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"grum": [ | |
"Composer\\Config::disableProcessTimeout", | |
"@php ./vendor/bin/grumphp run" | |
], | |
"style": [ | |
"composer run grum -- --tasks=phpcs" | |
], | |
"stan": [ | |
"composer run grum -- --tasks=phpstan" | |
], | |
"mess": [ | |
"composer run grum -- --tasks=phpmd" | |
], | |
"rector": [ | |
"Composer\\Config::disableProcessTimeout", | |
"@php ./vendor/bin/rector process" | |
], | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grumphp: | |
hooks_dir: ~ | |
hooks_preset: local | |
process_timeout: 480 | |
testsuites: | |
git_commit_msg: | |
tasks: [ | |
phpcs, | |
phpstan, | |
phpinsights | |
] | |
git_pre_commit: | |
tasks: [ | |
phpcs, | |
phpstan, | |
phpinsights | |
] | |
check: | |
tasks: [ | |
phpcs, | |
phpstan, | |
phpmd, | |
phpinsights, | |
rector | |
] | |
tasks: | |
composer: | |
file: ./composer.json | |
no_check_all: false | |
no_check_lock: false | |
no_check_publish: false | |
no_local_repository: false | |
with_dependencies: false | |
strict: false | |
phpversion: | |
project: '8.2' | |
phpcs: | |
phpstan: | |
configuration: phpstan.neon | |
memory_limit: "2G" | |
ignore_patterns: [ | |
'bootstrap/app.php', | |
'server.php' | |
] | |
phpmd: | |
whitelist_patterns: [/^app\/(.*)/] | |
report_format: text | |
ruleset: ['phpmd.xml'] | |
phpunit: | |
always_execute: true | |
rector: | |
stylelint: | |
bin: node_modules/.bin/stylelint | |
config: ./.stylelintrc.json | |
whitelist_patterns: | |
- /^resources\/(.*)/ | |
eslint: | |
bin: node_modules/.bin/standard | |
triggered_by: [js, jsx, ts, tsx, vue] | |
whitelist_patterns: | |
- /^resources\/js\/(.*)/ | |
- webpack.config.js | |
- webpack.mix.js | |
clover_coverage: | |
clover_file: ./code-analysis/clover.xml | |
level: 75 | |
git_commit_message: | |
allow_empty_message: false | |
enforce_capitalized_subject: false | |
enforce_no_subject_punctuations: false | |
enforce_no_subject_trailing_period: true | |
type_scope_conventions: | |
- types: | |
- build | |
- ci | |
- chore | |
- docs | |
- feat | |
- fix | |
- perf | |
- refactor | |
- revert | |
- style | |
- test | |
- scopes: [] | |
max_body_width: 72 | |
max_subject_width: 80 | |
phpinsights: | |
services: | |
Tests\GrumPHP\PhpInsightsTask: | |
arguments: | |
- '@process_builder' | |
- '@formatter.raw_process' | |
tags: | |
- {name: grumphp.task, task: phpinsights} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment