Last active
December 22, 2023 17:15
PHP linter for laravel project
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: php-lint | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
- staging | |
paths: | |
- "**.php" | |
pull_request: | |
branches: | |
- main | |
- develop | |
- staging | |
paths: | |
- "**.php" | |
concurrency: | |
group: ${{github.workflow}}-${{github.ref_name}} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
extensions: mbstring, intl, json, xdebug, opcache, exif, gd, pgsql, redis | |
ini-values: post_max_size=256M, log_errors=1 | |
tools: composer | |
coverage: none | |
- name: Setup problem matchers for PHP | |
run: | | |
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
- name: Get cache directories | |
id: cache-dir | |
run: | | |
echo "composer-dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache composer dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.cache-dir.outputs.composer-dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install depedencies | |
run: | | |
composer install --prefer-dist --optimize-autoloader --no-progress --no-interaction --no-scripts | |
- run: composer run php-cs-fixer | |
env: | |
CACHE_DRIVER: array | |
SESSION_DRIVER: array | |
- run: composer run phpstan | |
env: | |
CACHE_DRIVER: array | |
SESSION_DRIVER: array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment