File tree Expand file tree Collapse file tree 4 files changed +41
-16
lines changed Expand file tree Collapse file tree 4 files changed +41
-16
lines changed Original file line number Diff line number Diff line change 2626 coverage : none
2727 tools : cs2pr
2828
29- - name : ' Lint PHP against parse errors'
30- run : ./bin/php-lint
31-
3229 - name : Install xmllint
3330 run : sudo apt-get install --no-install-recommends -y libxml2-utils
3431
Original file line number Diff line number Diff line change 1111 workflow_dispatch :
1212
1313jobs :
14+ # ### PHP LINT STAGE ####
15+ # Linting against high/low PHP versions should catch everything.
16+ # If needs be, we can always add interim versions at a later point in time.
17+ lint :
18+ runs-on : ubuntu-latest
19+
20+ strategy :
21+ matrix :
22+ php : ['5.4', 'latest']
23+ experimental : [false]
24+
25+ include :
26+ - php : ' 8.1'
27+ experimental : true
28+
29+ name : " Lint: PHP ${{ matrix.php }}"
30+ continue-on-error : ${{ matrix.experimental }}
31+
32+ steps :
33+ - name : Checkout code
34+ uses : actions/checkout@v2
35+
36+ - name : Install PHP
37+ uses : shivammathur/setup-php@v2
38+ with :
39+ php-version : ${{ matrix.php }}
40+ coverage : none
41+ tools : cs2pr
42+
43+ - name : Install Composer dependencies
44+ uses : " ramsey/composer-install@v1"
45+
46+ - name : Lint against parse errors
47+ run : ./bin/php-lint --checkstyle | cs2pr
48+
1449 test :
50+ # No use running the tests if there is a linting error somewhere as they would fail anyway.
51+ needs : lint
52+
1553 runs-on : ubuntu-latest
1654
1755 strategy :
Original file line number Diff line number Diff line change 22#
33# Lint the PHP files against parse errors.
44#
5- # The find utility recursively descends the directory tree for each path listed.
6- #
7- # find . = Start with all files in this package
8- # -path ./vendor -prune = But remove those in the vendor directory
9- # -o -path ./bin -prune = And remove those in the bin directory
10- # -o -path ./.git -prune = And remove those in the .git directory
11- # -o -name "*.php" = And only consider those with a .php extension
12- # -exec php -l {} = Run PHP linter on the remaining files
13- # | grep "^[Parse error|Fatal error]" = Look in the results for any parse or fatal errors.
14- #
155# EXAMPLE TO RUN LOCALLY:
166#
177# ./bin/php-lint
188#
199
20- if find . -path ./vendor -prune -o -path ./bin -prune -o -path ./.git -prune -o -name " *.php" -exec php -l -f {} \; | grep " ^[Errors parsing]" ; then
21- exit 1;
22- fi
10+ " $( pwd) /vendor/bin/parallel-lint" . -e php --exclude vendor --exclude .git $@
Original file line number Diff line number Diff line change 2222 "wp-coding-standards/wpcs" : " ^2.3"
2323 },
2424 "require-dev" : {
25+ "php-parallel-lint/php-parallel-lint" : " ^1.0" ,
26+ "php-parallel-lint/php-console-highlighter" : " ^0.5" ,
2527 "phpcompatibility/php-compatibility" : " ^9" ,
2628 "phpunit/phpunit" : " ^4 || ^5 || ^6 || ^7"
2729 },
You can’t perform that action at this time.
0 commit comments