diff --git a/.github/workflows/plugin-ci-workflow.yml b/.github/workflows/plugin-ci-workflow.yml index edadadc..03352a3 100644 --- a/.github/workflows/plugin-ci-workflow.yml +++ b/.github/workflows/plugin-ci-workflow.yml @@ -62,6 +62,8 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: path: cacti/plugins/flowview + # patch-coverage.php diffs against the base branch below. + fetch-depth: 0 - name: Install PHP ${{ matrix.php }} uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 @@ -179,13 +181,23 @@ jobs: run: echo -n "${{ env.CACTI }}" | sudo tee ${{ github.workspace }}/cacti/plugins/flowview/tests/.cacti-version > /dev/null - name: Run Pest Unit Tests - env: - COMPOSER_ROOT_VERSION: 1.3.0-dev run: | cd ${{ github.workspace }}/cacti include/vendor/bin/pest --configuration=plugins/flowview/phpunit.xml \ --coverage-clover=plugins/flowview/coverage/clover.xml + # Whole-file coverage is meaningless here: most of the plugin only runs + # inside a live Cacti. What is enforceable is that a change covers the + # lines it adds. + - name: Enforce coverage of changed lines + if: github.event_name == 'pull_request' + env: + BASE_REF: ${{ github.event.pull_request.base.sha }} + run: | + cd ${{ github.workspace }}/cacti/plugins/flowview + git config --global --add safe.directory ${{ github.workspace }}/cacti/plugins/flowview + php tests/bin/patch-coverage.php coverage/clover.xml "$BASE_REF" 100 + - name: Upload coverage report if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 diff --git a/.gitignore b/.gitignore index f141813..8782705 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ config.php locales/po/*.mo locales/LC_MESSAGES/*.mo .omc/ +locales/po/*.po diff --git a/CHANGELOG.md b/CHANGELOG.md index 99432e9..6ce8b55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ --- develop --- +* dev: Enforce patch coverage of changed lines in CI and remove the inert COMPOSER_ROOT_VERSION env from the Pest step * issue#110: Add NAT (postNAT source/destination IP and port) support to the core raw flow schema, filters, and DNS resolution; see flowview_upgrade_nat_columns.php to backfill existing partitions * security: Add a version-safe CSP nonce (`plugin_flowview_csp_nonce()`) to every inline `