.github/workflows/static.yml
###############################################################################
# Sobre o GitHub Actions #
# https://docs.github.com/en/actions/learn-github-actions #
# https://www.youtube.com/watch?v=TLB5MY9BBa4 #
###############################################################################
#
# Executa a análise estática do código php, bem como força o padrão de
# codificação.
#
# PHPStan: análise estática https://phpstan.org/
# PHP CS Fixer: padrão de codificação php https://github.com/FriendsOfPHP/PHP-CS-Fixer
name: Qualidade de código
on: ["workflow_dispatch", "push", "pull_request"]
concurrency:
group: qualidade-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
phpstan:
runs-on: ubuntu-latest
name: PHPStan - Análise estática de código
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
tools: composer:v2
coverage: none
- name: Install dependencies
run: composer update --prefer-stable --no-interaction --no-progress
- name: Run PHPStan
run: ./vendor/bin/phpstan analyse --ansi --memory-limit 1G --error-format=github --debug
laravel-pint:
runs-on: ubuntu-latest
name: PINT - Padrão de código com Laravel Pint
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
tools: composer:v2
coverage: none
- name: Install dependencies
run: composer update --prefer-stable --no-interaction --no-progress
- name: Run Laravel PINT
run: ./vendor/bin/pint
- name: Auto Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "style: força padrão de código com pint"
branch: ${{ github.head_ref }}