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 : Checkout repository
23+ uses : actions/checkout@v4
24+
25+ - name : Setup PHP with quality tools
26+ uses : shivammathur/setup-php@v2
27+
28+ # TODO: extensions and caching if we use them
29+ with :
30+ php-version : ${{ matrix.php-versions }}
31+ tools : composer, php-cs-fixer, rector, phpstan
32+ env :
33+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
34+
35+ - name : Get composer cache directory
36+ id : composer-cache
37+ run : echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
38+
39+ - name : Cache dependencies
40+ uses : actions/cache@v4
41+ with :
42+ path : ${{ steps.composer-cache.outputs.dir }}
43+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
44+ restore-keys : ${{ runner.os }}-composer-
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 : Setup PHP Code Quality Tools
59+ run : composer run install-tools
60+
61+ - name : Lint PHP files (CS)
62+ run : composer run fix-cs -- --dry-run --diff --using-cache=no --stop-on-violation --show-progress=bar
63+
64+ - name : Static analysis on PHP files
65+ run : composer run phpstan -- -n
66+
67+ - name : Lint with Rector
68+ run : composer run rector -- -n --no-cache
69+
70+ # TODO: lint MD files, lint JS & CSS
0 commit comments