Better typehinting #8
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 styling | |
on: | |
push: | |
branches: | |
- main | |
- 0.x | |
- 1.x | |
paths: | |
- '**.php' | |
pull_request: | |
branches: | |
- main | |
- 0.x | |
- 1.x | |
paths: | |
- '**.php' | |
jobs: | |
format: | |
name: Run code formatters and analysis | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Checkout code | |
uses: actions/checkout@v3 | |
- name: π₯ Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
coverage: none | |
tools: cs2pr | |
- name: π¦ Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
- name: πΎ Cache Laravel Pint results | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-pint | |
with: | |
path: .php-cs-fixer.cache | |
key: ${{ github.repository }}-${{ env.cache-name }}-${{ github.sha }} | |
restore-keys: | | |
${{ github.repository }}-${{ env.cache-name }}- | |
- name: πΎ Cache PHPStan results | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-phpstan | |
with: | |
path: /tmp/phpstan/resultCache.php | |
key: ${{ github.repository }}-${{ env.cache-name }}-${{ github.sha }} | |
restore-keys: | | |
${{ github.repository }}-${{ env.cache-name }}- | |
- name: π Run linting | |
id: run-pint | |
run: composer lint -- --test | |
- name: π Generate annotations for linting | |
if: failure() && steps.run-pint.outcome != 'success' | |
run: composer lint -- --test --format=checkstyle | cs2pr | |
- name: π§ Run static analysis | |
run: composer analyse -- --error-format=github --no-ansi --no-progress |