-
Notifications
You must be signed in to change notification settings - Fork 29
101 lines (89 loc) · 3.54 KB
/
Copy pathcode-quality.yml
File metadata and controls
101 lines (89 loc) · 3.54 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
93
94
95
96
97
98
99
100
101
# +-------------------------------------------------------------------------+
# | Copyright (C) 2004-2026 The Cacti Group |
# | |
# | This program is free software; you can redistribute it and/or |
# | modify it under the terms of the GNU General Public License |
# | as published by the Free Software Foundation; either version 2 |
# | of the License, or (at your option) any later version. |
# +-------------------------------------------------------------------------+
# | Cacti: The Complete RRDtool-based Graphing Solution |
# +-------------------------------------------------------------------------+
name: Code Quality
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
permissions:
contents: read
jobs:
lint:
name: PHP Lint (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout plugin
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
# Lint only the plugin's own PHP. Vendored code (Net/, vendor/) is pruned
# so third-party sources never gate the plugin.
- name: Lint plugin PHP
run: |
find . -path ./.git -prune \
-o -path ./Net -prune \
-o -path ./vendor -prune \
-o -name '*.php' -print0 \
| xargs -0 -n1 -P4 php -l
phpstan:
name: PHPStan level 6 (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout Cacti core
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: Cacti/cacti
ref: release/1.2.31
path: cacti
- name: Checkout plugin
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: cacti/plugins/mactrack
- name: Install PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2, phpstan
# Cacti core ships an incomplete vendor tree; its bootstrap needs the
# runtime dependencies installed so core functions resolve for PHPStan.
- name: Install Cacti core dependencies
working-directory: cacti
run: composer install --no-dev --no-interaction --no-progress
# release/1.2.31 does not ship .phpstan-bootstrap.php (develop does).
# Provide a no-op stub so the plugin config can load either core tree.
- name: Ensure PHPStan bootstrap exists
working-directory: cacti
run: |
if [ ! -f .phpstan-bootstrap.php ]; then
printf '%s\n' '<?php' '// Stub bootstrap for Cacti trees without a core PHPStan entrypoint' > .phpstan-bootstrap.php
fi
# Analysis runs against the plugin's own code only; the config excludes
# Net/ and vendor/. The committed baseline pins the accepted findings.
- name: Run PHPStan
working-directory: cacti/plugins/mactrack
run: phpstan analyse --configuration=.phpstan.neon --no-progress --memory-limit=2G