3232 - develop
3333
3434jobs :
35+ quality-checks :
36+ name : PHP Quality (Lint, Stan, CS)
37+ runs-on : ubuntu-latest
38+ steps :
39+ - name : Checkout Cacti
40+ uses : actions/checkout@v4
41+ with :
42+ repository : Cacti/cacti
43+ path : cacti
44+
45+ - name : Checkout Syslog Plugin
46+ uses : actions/checkout@v4
47+ with :
48+ path : cacti/plugins/syslog
49+
50+ - name : Setup PHP 8.3
51+ uses : shivammathur/setup-php@v2
52+ with :
53+ php-version : ' 8.3'
54+ extensions : intl, mysql, gd, ldap, gmp, xml, curl, json, mbstring
55+ tools : php-cs-fixer, phpstan
56+
57+ - name : Check PHP Syntax (Lint)
58+ run : |
59+ cd cacti/plugins/syslog
60+ if find . -name '*.php' -not -path './vendor/*' -exec php -l {} 2>&1 \; | grep -iv 'no syntax errors detected'; then
61+ print "Syntax errors found!"
62+ exit 1
63+ fi
64+
65+ - name : Run PHP CS Fixer (Dry Run)
66+ run : |
67+ cd cacti/plugins/syslog
68+ php-cs-fixer fix --dry-run --diff --ansi --config=../../../.php-cs-fixer.php . || true
69+
70+ - name : Create PHPStan config
71+ run : |
72+ cd cacti/plugins/syslog
73+ cat > phpstan.neon << 'EOF'
74+ parameters:
75+ level: 5
76+ paths:
77+ - .
78+ excludePaths:
79+ - vendor/
80+ - locales/
81+ ignoreErrors:
82+ - '#has invalid return type the\.#'
83+ bootstrapFiles:
84+ - ../../include/global.php
85+ EOF
86+
87+ - name : Run PHPStan Analysis
88+ run : |
89+ cd cacti/plugins/syslog
90+ phpstan analyse --no-progress --error-format=github || true
91+
3592 integration-test :
93+ needs : quality-checks
3694 runs-on : ${{ matrix.os }}
3795
3896 strategy :
@@ -104,7 +162,6 @@ jobs:
104162 - name : Create MySQL Config
105163 run : |
106164 echo -e "[client]\nuser = root\npassword = cactiroot\nhost = 127.0.0.1\n" > ~/.my.cnf
107- cat ~/.my.cnf
108165
109166 - name : Initialize Cacti Database
110167 env :
@@ -148,7 +205,7 @@ jobs:
148205 sed -i "s/'cacti'/'cacti'/g" ${{ github.workspace }}/cacti/plugins/syslog/config.php
149206 sed -i "s/'cactiuser'/'cactiuser'/g" ${{ github.workspace }}/cacti/plugins/syslog/config.php
150207 sed -i 's/\/\/\$/\$/g' ${{ github.workspace }}/cacti/plugins/syslog/config.php
151- sudo chmod 664 ${{ github.workspace }}/cacti/plugins/syslog /config.php
208+ sudo chmod 664 ${{ github.workspace }}/cacti/include /config.php
152209
153210 - name : Configure Apache
154211 run : |
@@ -179,14 +236,6 @@ jobs:
179236 run : |
180237 cd ${{ github.workspace }}/cacti
181238 sudo php cli/plugin_manage.php --plugin=syslog --install --enable
182-
183- - name : Check PHP Syntax for Plugin
184- run : |
185- cd ${{ github.workspace }}/cacti/plugins/syslog
186- if find . -name '*.php' -exec php -l {} 2>&1 \; | grep -iv 'no syntax errors detected'; then
187- echo "Syntax errors found!"
188- exit 1
189- fi
190239
191240 - name : Run Plugin Regression Tests
192241 run : |
@@ -204,7 +253,7 @@ jobs:
204253 cd ${{ github.workspace }}/cacti
205254 sudo php poller.php --poller=1 --force --debug
206255 if ! grep -q "SYSTEM STATS" log/cacti.log; then
207- echo "Cacti poller did not finish successfully"
256+ print "Cacti poller did not finish successfully"
208257 cat log/cacti.log
209258 exit 1
210259 fi
@@ -221,7 +270,7 @@ jobs:
221270 cd ${{ github.workspace }}/cacti
222271 sudo php plugins/syslog/syslog_process.php --debug
223272 if ! grep -q "SYSTEM SYSLOG STATS" log/cacti.log; then
224- echo "Syslog plugin poller did not finish successfully"
273+ print "Syslog plugin poller did not finish successfully"
225274 cat log/cacti.log
226275 exit 1
227276 fi
@@ -231,41 +280,6 @@ jobs:
231280 if : always()
232281 run : |
233282 if [ -f ${{ github.workspace }}/cacti/log/cacti.log ]; then
234- echo "=== Cacti Log ==="
283+ print "=== Cacti Log ==="
235284 sudo cat ${{ github.workspace }}/cacti/log/cacti.log
236285 fi
237-
238-
239- - name : Create PHPStan config
240- run : |
241- cd ${{ github.workspace }}/cacti/plugins/syslog
242- cat > phpstan.neon << 'EOF'
243- parameters:
244- level: 5
245- paths:
246- - .
247- excludePaths:
248- - vendor/
249- - locales/
250- ignoreErrors:
251- - '#has invalid return type the\.#'
252- bootstrapFiles:
253- - ../../include/global.php
254- EOF
255-
256- - name : Install PHPStan
257- run : |
258- cd ${{ github.workspace }}/cacti/plugins/syslog
259- composer require --dev phpstan/phpstan --with-all-dependencies || composer global require phpstan/phpstan
260-
261- - name : Run PHPStan Analysis
262- run : |
263- cd ${{ github.workspace }}/cacti/plugins/syslog
264- if [ -f vendor/bin/phpstan ]; then
265- vendor/bin/phpstan analyse --no-progress --error-format=github || true
266- else
267- phpstan analyse --no-progress --error-format=github || true
268- fi
269- continue-on-error : true
270-
271-
0 commit comments