Skip to content

Instantly share code, notes, and snippets.

@muhammedkamel
Last active December 22, 2023 17:15
Show Gist options
  • Save muhammedkamel/d47c0432ea9f9e0bd0b4a596a792d4f7 to your computer and use it in GitHub Desktop.
Save muhammedkamel/d47c0432ea9f9e0bd0b4a596a792d4f7 to your computer and use it in GitHub Desktop.
PHP linter for laravel project
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