1+ name : Lint
2+
3+ on :
4+ push :
5+ pull_request :
6+
7+ env :
8+ fail-fast : true
9+
10+ permissions :
11+ contents : read
12+
13+ jobs :
14+ lint :
15+ name : Lint
16+ runs-on : ubuntu-latest
17+ strategy :
18+ matrix :
19+ operating-system : [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]
20+ php-versions : [ '8.3', '8.4' ]
21+ steps :
22+ - name : Setup PHP with quality tools
23+ uses : shivammathur/setup-php@v2
24+
25+ # TODO: extensions and caching if we use them
26+ with :
27+ php-version : ${{ matrix.php-versions }}
28+ tools : composer, php-cs-fixer, rector, phpstan
29+ env :
30+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
31+
32+ - name : Get composer cache directory
33+ id : composer-cache
34+ run : echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
35+
36+ - name : Cache dependencies
37+ uses : actions/cache@v4
38+ with :
39+ path : ${{ steps.composer-cache.outputs.dir }}
40+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
41+ restore-keys : ${{ runner.os }}-composer-
42+
43+ - name : List files for debugging
44+ run : ls -la && pwd
45+
46+ - name : Lint composer
47+ run : composer validate --strict
48+
49+ - name : Install dependencies
50+ run : composer install --prefer-dist
51+
52+ - name : Composer normalize
53+ run : composer normalize --dry-run
54+
55+ - name : Composer audit
56+ run : composer audit
57+
58+ - name : Lint YAML files
59+ run : php bin/console lint:yaml config/ src/ --parse-tags --env=prod
60+
61+ - name : Lint Twig templates
62+ run : php bin/console lint:twig templates/ --env=prod
63+
64+ - name : Lint Parameters and Services
65+ run : php bin/console lint:container --no-debug --env=prod
66+
67+ - name : Lint Doctrine entities
68+ run : php bin/console doctrine:schema:validate --skip-sync -vvv --no-interaction --env=prod
69+
70+ - name : Setup PHP Code Quality Tools
71+ run : composer run install-tools
72+
73+ - name : Lint PHP files (CS)
74+ run : composer run fix-cs -- --dry-run --diff --using-cache=no --stop-on-violation --show-progress=bar
75+
76+ - name : Static analysis on PHP files
77+ run : composer run phpstan -- -n
78+
79+ - name : Lint with Rector
80+ run : composer run rector -- -n --no-cache
81+
82+ # TODO: lint MD files, lint JS & CSS
0 commit comments