Skip to content

Commit

Permalink
chore(ci): add a lint job
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceAmstoutz committed Feb 8, 2025
1 parent 444cc83 commit ea1b627
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Lint

on:
push:
pull_request:

env:
fail-fast: true

permissions:
contents: read

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
operating-system: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]
php-versions: [ '8.3', '8.4' ]
steps:
- name: Setup PHP with quality tools
uses: shivammathur/setup-php@v2

#TODO: extensions and caching if we use them
with:
php-version: ${{ matrix.php-versions }}
tools: composer, php-cs-fixer, rector, phpstan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: List files for debugging
run: ls -la && pwd

- name: Lint composer
run: composer validate --strict

- name: Install dependencies
run: composer install --prefer-dist

- name: Composer normalize
run: composer normalize --dry-run

- name: Composer audit
run: composer audit

- name: Lint YAML files
run: php bin/console lint:yaml config/ src/ --parse-tags --env=prod

- name: Lint Twig templates
run: php bin/console lint:twig templates/ --env=prod

- name: Lint Parameters and Services
run: php bin/console lint:container --no-debug --env=prod

- name: Lint Doctrine entities
run: php bin/console doctrine:schema:validate --skip-sync -vvv --no-interaction --env=prod

- name: Setup PHP Code Quality Tools
run: composer run install-tools

- name: Lint PHP files (CS)
run: composer run fix-cs -- --dry-run --diff --using-cache=no --stop-on-violation --show-progress=bar

- name: Static analysis on PHP files
run: composer run phpstan -- -n

- name: Lint with Rector
run: composer run rector -- -n --no-cache

#TODO: lint MD files, lint JS & CSS

0 comments on commit ea1b627

Please sign in to comment.