-
Notifications
You must be signed in to change notification settings - Fork 36
92 lines (77 loc) · 2.41 KB
/
Copy pathPHP.yml
File metadata and controls
92 lines (77 loc) · 2.41 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: PHP
on:
push:
branches:
- main
pull_request:
branches:
- main
#env:
# PHP_CS_FIXER_IGNORE_ENV: 1
jobs:
static-analysis:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ '8.2', '8.3', '8.4', '8.5' ]
name: Static analysis for version ${{ matrix.php-version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
# tools: parallel-lint, php-cs-fixer
tools: parallel-lint, phpcs
- name: Setup dependencies
run: |
git clone --depth 1 https://github.com/Icinga/icingaweb2.git vendor/icingaweb2
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-library.git vendor/icinga-php-library
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git vendor/icinga-php-thirdparty
- name: composer install
run: |
if [ -f composer.json ]; then
composer install --no-progress --no-suggest --prefer-dist
fi
- name: Lint
run: parallel-lint --exclude vendor .
# - name: Code Style
# run: |
# cat <<'EOF' >.php-cs-fixer.dist.php
# <?php
#
# declare(strict_types=1);
#
# use PhpCsFixer\Config;
# use PhpCsFixer\Finder;
#
# return (new Config())
# ->setRules([
# '@PSR12' => true
# ])
# ->setFinder((new Finder())
# ->exclude(['vendor'])
# ->in(__DIR__)
# );
# EOF
#
# php-cs-fixer fix --dry-run --diff
- name: Code Style
run: |
cat <<'EOF' >phpcs.xml
<?xml version="1.0"?>
<ruleset name="PSR12">
<!-- Test all PHP files except those in vendor/ -->
<file>./</file>
<arg name="extensions" value="php"/>
<exclude-pattern>vendor/*</exclude-pattern>
<arg name="report-width" value="auto"/>
<arg name="report-full"/>
<arg name="report-gitblame"/>
<arg name="report-summary"/>
<arg name="encoding" value="UTF-8"/>
<rule ref="PSR12"/>
</ruleset>
EOF
phpcs -wps --colors