-
Notifications
You must be signed in to change notification settings - Fork 6
49 lines (39 loc) · 1.25 KB
/
php-linter.yml
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
# vim: set colorcolumn=:
name: php-linter
on:
push:
pull_request:
workflow_dispatch:
inputs:
php_version:
description: "Specify the PHP version to use (e.g., 8.0, 8.1)"
required: false
default: '8.1'
env:
PHP_VERSION: ${{ inputs.php_version || '8.1' }}
permissions:
contents: read
jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update apt cache
run: sudo apt-get update
- name: Install php ${{ env.PHP_VERSION }}
run: sudo apt-get install php${{ env.PHP_VERSION }}-cli
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: lib
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install composer/vendor dependencies
run: composer install --prefer-dist --no-progress --ignore-platform-reqs
- name: Validate PHP syntax
run: bash -c 'set -e;for file in $(find ./src -type f -regex ".*\.\(php\|phtml\)" -print); do php -e -l -f "$file"; done'