-
Notifications
You must be signed in to change notification settings - Fork 142
43 lines (34 loc) · 1.27 KB
/
php.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
# @Author: Roni Laukkarinen
# @Date: 2023-02-15 17:39:37
# @Last Modified by: Roni Laukkarinen
# @Last Modified time: 2023-05-18 17:26:05
name: PHP
on: [push, pull_request]
env:
PHPCS_DIR: /tmp/phpcs
PHPCOMPAT_DIR: /tmp/phpcompatibility
SNIFFS_DIR: /tmp/sniffs
WPCS_DIR: /tmp/wpcs
jobs:
build:
name: Test php
runs-on: ubuntu-20.04
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Setup PHP with Xdebug 2.x
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: xdebug2
- name: Set up PHPCS and WordPress-Coding-Standards
run: |
git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR
git clone -b 2.2.1 --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $WPCS_DIR
$PHPCS_DIR/bin/phpcs --config-set installed_paths $WPCS_DIR,$PHPCOMPAT_DIR,$SNIFFS_DIR
git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $PHPCOMPAT_DIR
- name: Run PHPCS
run: |
$PHPCS_DIR/bin/phpcs -p . --ignore=node_modules,*/css/*,*/sass/* --standard=phpcs.xml
- name: Test PHP for syntax errors
run: find -L . -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l