Skip to content

Code coverage support#49

Open
froozeify wants to merge 9 commits intoglpi-project:v1from
froozeify:code-coverage
Open

Code coverage support#49
froozeify wants to merge 9 commits intoglpi-project:v1from
froozeify:code-coverage

Conversation

@froozeify
Copy link
Member

@froozeify froozeify commented Dec 31, 2025

This PR add code coverage support for plugin.

By default the coverage is not enabled.

For a better output, plugin can extract the report to automatically create a comment on the PR with the report in md format.

Interconnected PR :

Whatsapp plugin got a dedicated PR to test the modification (see in the feed under for the link)

@froozeify froozeify marked this pull request as ready for review December 31, 2025 11:10
@froozeify froozeify changed the title Code coverage Code coverage support Dec 31, 2025
@froozeify froozeify requested review from Rom1-B and stonebuzz and removed request for AdrienClairembault and trasher December 31, 2025 14:42
run: |
sudo service apache2 start
- name: "Setup coverage driver"
if: ${{ !cancelled() && inputs.code-coverage == true }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For activation, I think we need to follow the same logic as the other steps and test for the presence of the configuration file instead of defining a variable.

Suggested change
if: ${{ !cancelled() && inputs.code-coverage == true }}
if: ${{ !cancelled() && hashFiles(format('{0}/cobertura.xml', inputs.plugin-key)) != '' }}

Same logic every time you test inputs.code-coverage == true

@froozeify
Copy link
Member Author

froozeify commented Feb 9, 2026

We should create a dedicated config file. For example .glpi-coverage.json

If the file is not present or if his field enabled is false we don't run code coverage.

Enabled field is optional, value is true by default. For glpi-empty, we would be able like that to set it has example with enabled: false

This file would should contain something like

{
  "enabled": true,
  "lower_threshold": 50,
  "upper_threshold": 75,
  "fail_below_min": false
}

We should probably also create a generic action for the code coverage report config in that case. (if feasible)
This will avoid to have to put that config on every plugin : https://github.com/glpi-network/whatsapp/pull/32/changes#diff-c471496bcb3ed47397b73d2e3e3aa41a8a679c86accaed9e05676fd9d5987434R41-R70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants