|
| 1 | +# +-------------------------------------------------------------------------+ |
| 2 | +# | Copyright (C) 2004-2026 The Cacti Group | |
| 3 | +# | | |
| 4 | +# | This program is free software; you can redistribute it and/or | |
| 5 | +# | modify it under the terms of the GNU General Public License | |
| 6 | +# | as published by the Free Software Foundation; either version 2 | |
| 7 | +# | of the License, or (at your option) any later version. | |
| 8 | +# | | |
| 9 | +# | This program is distributed in the hope that it will be useful, | |
| 10 | +# | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | +# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 | +# | GNU General Public License for more details. | |
| 13 | +# +-------------------------------------------------------------------------+ |
| 14 | +# | Cacti: The Complete RRDtool-based Graphing Solution | |
| 15 | +# +-------------------------------------------------------------------------+ |
| 16 | +# | This code is designed, written, and maintained by the Cacti Group. See | |
| 17 | +# | about.php and/or the AUTHORS file for specific developer information. | |
| 18 | +# +-------------------------------------------------------------------------+ |
| 19 | +# | http://www.cacti.net/ | |
| 20 | +# +-------------------------------------------------------------------------+ |
| 21 | + |
| 22 | +name: Code Quality |
| 23 | + |
| 24 | +on: |
| 25 | + push: |
| 26 | + branches: |
| 27 | + - main |
| 28 | + - develop |
| 29 | + pull_request: |
| 30 | + branches: |
| 31 | + - main |
| 32 | + - develop |
| 33 | + |
| 34 | +jobs: |
| 35 | + code-quality: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + php: ['8.1', '8.2', '8.3', '8.4'] |
| 42 | + |
| 43 | + name: PHP ${{ matrix.php }} Code Quality |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Checkout Cacti |
| 47 | + uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + repository: Cacti/cacti |
| 50 | + ref: develop |
| 51 | + path: cacti |
| 52 | + |
| 53 | + - name: Checkout audit Plugin |
| 54 | + uses: actions/checkout@v4 |
| 55 | + with: |
| 56 | + path: cacti/plugins/audit |
| 57 | + |
| 58 | + - name: Install PHP ${{ matrix.php }} |
| 59 | + uses: shivammathur/setup-php@v2 |
| 60 | + with: |
| 61 | + php-version: ${{ matrix.php }} |
| 62 | + extensions: intl, mysql, gd, ldap, gmp, mbstring, dom, xml, json, sockets |
| 63 | + coverage: none |
| 64 | + ini-values: "memory_limit=512M" |
| 65 | + |
| 66 | + - name: Check PHP version |
| 67 | + run: php -v |
| 68 | + |
| 69 | + - name: Validate Cacti Composer files |
| 70 | + run: composer validate --strict |
| 71 | + working-directory: cacti |
| 72 | + |
| 73 | + - name: Install Cacti development dependencies |
| 74 | + run: composer install --prefer-dist --no-progress |
| 75 | + working-directory: cacti |
| 76 | + |
| 77 | + - name: Lint audit Plugin |
| 78 | + run: include/vendor/bin/phplint --no-cache --exclude=locales plugins/audit |
| 79 | + working-directory: cacti |
| 80 | + |
| 81 | + - name: Run PHP-CS-Fixer (dry-run) |
| 82 | + run: include/vendor/bin/php-cs-fixer fix --dry-run --diff --config=plugins/audit/.php-cs-fixer.php --allow-unsupported-php-version=yes |
| 83 | + working-directory: cacti |
| 84 | + |
| 85 | + - name: Run PHPStan |
| 86 | + run: include/vendor/bin/phpstan analyse --configuration=plugins/audit/.phpstan.neon --memory-limit=512M --no-progress |
| 87 | + working-directory: cacti |
| 88 | + |
| 89 | + - name: Run Pest Tests |
| 90 | + if: ${{ matrix.php != '8.1' }} |
| 91 | + run: include/vendor/bin/pest plugins/audit/tests/Security --display-warnings |
| 92 | + working-directory: cacti |
| 93 | + |
| 94 | + - name: Run Audit Security Helper Tests |
| 95 | + run: | |
| 96 | + php tests/security_functions_test.php |
| 97 | + php tests/controller_security_test.php |
| 98 | + php tests/syslog_queue_test.php |
| 99 | + timeout 60 php tests/syslog_functions_test.php |
| 100 | + working-directory: cacti/plugins/audit |
0 commit comments