Skip to content

Commit 9e581ae

Browse files
committed
add PHP lint job to github actions #2
1 parent 0c0a25c commit 9e581ae

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

.github/workflows/php.yml

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,50 @@
1-
name: PHP Composer
2-
1+
name: PHP
32
on:
43
push:
5-
branches: [ "main" ]
4+
branches:
5+
- "main"
66
pull_request:
7-
branches: [ "main" ]
7+
branches:
8+
- "main"
89

910
permissions:
10-
contents: read
11+
contents: "read"
1112

1213
jobs:
14+
lint:
15+
runs-on: "ubuntu-latest"
16+
strategy:
17+
matrix:
18+
php-version:
19+
- "7.2"
20+
- "7.4"
21+
- "8.1"
22+
name: "PHP ${{ matrix.php-versions }} lint"
23+
steps:
24+
- # git checkout
25+
name: "Checkout code"
26+
uses: "actions/checkout@v3"
27+
- # setup PHP
28+
name: "Setup PHP"
29+
uses: "shivammathur/setup-php@v2"
30+
with:
31+
php-version: "${{ matrix.php-version }}"
32+
- # check PHP version
33+
name: "Check PHP version"
34+
run: "php -v"
35+
- # run lint
36+
name: "Lint PHP files"
37+
run: |
38+
for file in $(find src/ -type f -name '*.php'); do
39+
echo -n "==> ${file}: ";
40+
php -l "${file}";
41+
done
1342
build:
1443

1544
runs-on: ubuntu-latest
1645

46+
name: "PHP composer & CodeSniffer"
47+
1748
steps:
1849
- uses: actions/checkout@v3
1950

0 commit comments

Comments
 (0)