File: lint.yml

package info (click to toggle)
composer 2.9.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,528 kB
  • sloc: php: 83,030; makefile: 59; xml: 39
file content (51 lines) | stat: -rw-r--r-- 1,235 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
        with:
          php-version: "${{ matrix.php-version }}"
          coverage: none

      - uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # 3.1.1
        with:
          dependency-versions: highest

      - 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