Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Document user-visible or release-impacting changes in `CHANGELOG.md`; use descri
## CI & Dependency Baselines

- Do not commit a `composer.json` or `composer.lock` in this plugin's own repo root — the shared CI workflow installs Pest/dev dependencies into Cacti's own Composer-managed vendor tree (checked out alongside the plugin). Use Cacti's `composer.json`, not a plugin-local one.
- Do not add a plugin-local `.phpstan.neon`/`phpstan.neon` or `.php-cs-fixer.php`/`.php-cs-fixer.dist.php` — lint/static-analysis steps run against Cacti's own config from the Cacti core checkout, targeting this plugin's directory. Use the Cacti version, not a plugin-local config.
- For local PHPStan and PHP-CS-Fixer checks, use Cacti core's configuration and target this plugin's directory. Keep the configuration files in the core checkout.
- Prefer Cacti's `cacti_count()`/`cacti_sizeof()` wrappers over the raw `count()`/`sizeof()` builtins in new or edited code.

## Internationalization (i18n)
Expand Down
48 changes: 15 additions & 33 deletions .github/workflows/plugin-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ jobs:
# file owner, so the runner user must own the tree here; www-data keeps
# group access. Ownership is handed back to www-data before polling.
sudo chown -R runner:www-data ${{ github.workspace }}/cacti
sudo find ${{ github.workspace }}/cacti -type d -exec chmod 775 {} \;
sudo find ${{ github.workspace }}/cacti -type f -exec chmod 664 {} \;
sudo find ${{ github.workspace }}/cacti -type d -exec chmod 775 {} +
sudo find ${{ github.workspace }}/cacti -type f -exec chmod 664 {} +
sudo chmod +x ${{ github.workspace }}/cacti/cmd.php
sudo chmod +x ${{ github.workspace }}/cacti/poller.php

Expand Down Expand Up @@ -243,30 +243,6 @@ jobs:
path: ${{ github.workspace }}/cacti/plugins/monitor/coverage/
if-no-files-found: warn

- name: Remove the plugins directory exclusion from the .phpstan.neon
if: ${{ env.CACTI != '1.2.x' }}
run: sed '/plugins/d' -i .phpstan.neon
working-directory: ${{ github.workspace }}/cacti

- name: Mark composer scripts executable
if: ${{ env.CACTI != '1.2.x' }}
run: sudo chmod +x ${{ github.workspace }}/cacti/include/vendor/bin/*

- name: Run Linter on base code
if: ${{ env.CACTI != '1.2.x' }}
run: composer run-script lint ${{ github.workspace }}/cacti/plugins/monitor
working-directory: ${{ github.workspace }}/cacti

- name: Checking coding standards on base code
if: ${{ env.CACTI != '1.2.x' }}
run: composer run-script phpcsfixer ${{ github.workspace }}/cacti/plugins/monitor
working-directory: ${{ github.workspace }}/cacti

- name: Run PHPStan at Level 6 on base code outside of Composer due to technical issues
if: ${{ env.CACTI != '1.2.x' }}
run: ./include/vendor/bin/phpstan analyze --level 6 ${{ github.workspace }}/cacti/plugins/monitor
working-directory: ${{ github.workspace }}/cacti

- name: Re-apply web user ownership before polling
run: |
# Ancestor directories above the checkout (e.g. /home/runner, .../work)
Expand All @@ -279,8 +255,8 @@ jobs:
done

sudo chown -R www-data:runner ${{ github.workspace }}/cacti
sudo find ${{ github.workspace }}/cacti -type d -exec chmod 775 {} \;
sudo find ${{ github.workspace }}/cacti -type f -exec chmod 664 {} \;
sudo find ${{ github.workspace }}/cacti -type d -exec chmod 775 {} +
sudo find ${{ github.workspace }}/cacti -type f -exec chmod 664 {} +
sudo chmod +x ${{ github.workspace }}/cacti/cmd.php
sudo chmod +x ${{ github.workspace }}/cacti/poller.php

Expand All @@ -306,9 +282,15 @@ jobs:
- name: Check Cacti Logs for Errors
if: always()
run: |
if [ -f ${{ github.workspace }}/cacti/log/cacti.log ]; then
if grep -E "FATAL:|ERROR:|WARNING:" ${{ github.workspace }}/cacti/log/cacti.log; then
echo "Found FATAL/ERROR/WARNING entries in Cacti log"
exit 1
fi
log="$GITHUB_WORKSPACE/cacti/log/cacti.log"
if ! sudo test -f "$log"; then
echo "Missing Cacti log: $log" >&2
exit 1
fi
status=0
sudo grep -E 'FATAL:|ERROR:|WARNING:' "$log" || status=$?
case "$status" in
0) echo "Found FATAL/ERROR/WARNING entries in Cacti log" >&2; exit 1 ;;
1) exit 0 ;;
*) exit "$status" ;;
esac