52 lines
1.1 KiB
YAML
52 lines
1.1 KiB
YAML
name: "PHP Lint"
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- 'doc/**'
|
|
pull_request:
|
|
paths-ignore:
|
|
- 'doc/**'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
tests:
|
|
name: "Lint"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
php-version:
|
|
- "7.2"
|
|
- "nightly"
|
|
|
|
steps:
|
|
- name: "Checkout"
|
|
uses: "actions/checkout@v4"
|
|
|
|
- name: "Install PHP"
|
|
uses: "shivammathur/setup-php@v2"
|
|
with:
|
|
coverage: "none"
|
|
extensions: "intl"
|
|
ini-values: "memory_limit=-1, error_reporting=E_ALL, display_errors=On"
|
|
php-version: "${{ matrix.php-version }}"
|
|
|
|
- name: "Lint PHP files"
|
|
run: |
|
|
hasErrors=0
|
|
for f in $(find src/ tests/ -type f -name '*.php' ! -path '*/vendor/*')
|
|
do
|
|
{ error="$(php -derror_reporting=-1 -ddisplay_errors=1 -l -f $f 2>&1 1>&3 3>&-)"; } 3>&1;
|
|
if [ "$error" != "" ]; then
|
|
while IFS= read -r line; do echo "::error file=$f::$line"; done <<< "$error"
|
|
hasErrors=1
|
|
fi
|
|
done
|
|
if [ $hasErrors -eq 1 ]; then
|
|
exit 1
|
|
fi
|