Skip to content
Open
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
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: friday
open-pull-requests-limit: 5
cooldown:
default-days: 7
groups:
github-actions:
patterns: ["*"]
update-types: [minor, patch]
commit-message:
prefix: ci
include: scope
60 changes: 33 additions & 27 deletions .github/workflows/plugin-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ on:
- main
- develop

permissions:
contents: read

env:
CACTI: 1.2.x
COMPOSER_ALLOW_SUPERUSER: 1
CACTI_REF: d6d230f712c0af1a0391646f65364950ebf131af # 1.2.x fixture

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
integration-test:
timeout-minutes: 45
runs-on: ${{ matrix.os }}

strategy:
Expand All @@ -47,7 +55,7 @@ jobs:

services:
mariadb:
image: mariadb:11.8
image: mariadb:11.8@sha256:6422478cb8e159f080fb1d8ccf65101e26fe51385787fde7d16c3b165a331f15
env:
MYSQL_ROOT_PASSWORD: cactiroot
MYSQL_DATABASE: cacti
Expand All @@ -67,13 +75,15 @@ jobs:
- name: Checkout Cacti
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: Cacti/cacti
ref: ${{ env.CACTI }}
ref: ${{ env.CACTI_REF }}
path: cacti

- name: Checkout tags Plugin
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
path: cacti/plugins/tags
# patch-coverage.php diffs against the base branch below.
fetch-depth: 0
Expand All @@ -82,6 +92,7 @@ jobs:
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ matrix.php }}
tools: composer:2.10.3
extensions: intl, mysql, gd, ldap, gmp, xml, curl, json, mbstring, snmp
ini-values: "post_max_size=256M, max_execution_time=60, date.timezone=America/New_York"
coverage: xdebug
Expand Down Expand Up @@ -131,29 +142,24 @@ jobs:
mysql "$MYSQL_AUTH_USR" cacti < ${{ github.workspace }}/cacti/cacti.sql
mysql "$MYSQL_AUTH_USR" -e "INSERT INTO settings (name, value) VALUES ('path_php_binary', '/usr/bin/php')" cacti

- name: Validate composer files
run: |
cd ${{ github.workspace }}/cacti
if [ -f composer.json ]; then
composer validate --strict || true
fi

- name: Install Composer Dependencies
run: |
cd ${{ github.workspace }}/cacti
if [ -f composer.json ]; then
sudo composer config --no-plugins allow-plugins.pestphp/pest-plugin true
sudo composer require --no-progress --no-interaction "pestphp/pest: ^3" "pestphp/pest-plugin-drift: ^3.0"
sudo rm -f composer.lock
sudo composer install --dev --no-progress
fi

- name: Restore vendor ownership for Pest
run: |
cd ${{ github.workspace }}/cacti
if [ -d include/vendor ]; then
sudo chown -R runner:runner include/vendor composer.lock
fi
# Core's release archives exclude .github and tests. Fetch these paths
# through Git at the immutable helper revision instead of an Action archive.
- name: Checkout shared CI tooling
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: Cacti/cacti
ref: f3ff777992875740e4665fedfe2eff8335f5b894
persist-credentials: false
path: ci-tools
sparse-checkout: |
.github/actions/setup-plugin-dependencies
tests/tools/plugin-harness

- name: Install locked Cacti and plugin test dependencies
uses: ./ci-tools/.github/actions/setup-plugin-dependencies
with:
cacti-directory: cacti
install-core-dev: 'false'

- name: Create Cacti config.php
run: |
Expand Down Expand Up @@ -194,7 +200,7 @@ jobs:
- name: Run Pest Unit Tests
run: |
cd ${{ github.workspace }}/cacti
include/vendor/bin/pest --configuration=plugins/tags/phpunit.xml \
"$CACTI_PEST_BIN" --configuration=plugins/tags/phpunit.xml \
--coverage-clover=plugins/tags/coverage/clover.xml

# Whole-file coverage is meaningless here: most of the plugin only runs
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
--- develop ---
* feature: Add option to hide tags from graphs
* feature: Turn the graph drilldown button into an 'Enable Tags'/'Disable Tags' toggle that reflects the current session state and shows or hides this plugin's tag legend lines on graphs, rather than a static link, so it reads cleanly as a label in Cacti's graph action menu
* security: Pin CI fixtures and shared test dependencies, disable persisted checkout credentials, and limit workflow permissions and runtime
* security: Replace the confirmation pages' inline `onClick='cactiReturnTo()'` Cancel buttons with the CSP-safe `cactiReturnTo` class so the pages no longer trip Cacti's Content-Security-Policy script-src-attr directive; see the README for the one-time `applySkin()` snippet needed when running Cacti below 1.2.31 (1.2.31+ binds the class automatically)
* security: Move the filter selects' inline onChange handlers into the ready block (and bind them via change, not click) so the page no longer trips Cacti's Content-Security-Policy script-src-attr directive
* dev: Measure CI coverage with xdebug instead of pcov so the plugin's own sources are instrumented (pcov auto-scopes to the Composer root and skipped cacti/plugins/, leaving the patch-coverage gate with nothing to measure)
Expand Down
Loading