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
35 changes: 35 additions & 0 deletions .github/workflows/continuous-integration.yml.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: "Continuous integration"

# To enable code coverage reporting,
# ensure that the project variable "CODE_COVERAGE" is set to "true"

Comment on lines +3 to +5
Copy link
Contributor

Choose a reason for hiding this comment

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

Already specified in README file

on:
push:
branches:
Expand Down Expand Up @@ -33,3 +36,35 @@ jobs:
glpi-version: "${{ matrix.glpi-version }}"
php-version: "${{ matrix.php-version }}"
db-image: "${{ matrix.db-image }}"
code-coverage: ${{ vars.CODE_COVERAGE == 'true' }} # Value is obtained from project variables

coverage-report:
needs: "ci"
if: vars.CODE_COVERAGE == 'true' && github.event_name == 'pull_request'
runs-on: "ubuntu-latest"
name: "Coverage report"
steps:
- name: "Download coverage report"
uses: "actions/download-artifact@v4"
with:
name: "coverage-report"

- name: "Generate coverage summary"
uses: "irongut/[email protected]"
with:
filename: cobertura.xml
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '50 75'

- name: "Add coverage comment"
uses: "marocchino/sticky-pull-request-comment@v2"
if: ${{ github.event_name == 'pull_request' }}
with:
header: coverage
path: code-coverage-results.md
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ You can also provide a destination path (ie. if your `empty` directory is not in
* `{UNAME}` will be replaced by the uppercased name,
* `{YEAR}` will be replaced by the current year.

## Enabling Code coverage
By default, code coverage is disabled.

If you want to enable it, you have to set your project environment variable `CODE_COVERAGE` to `true`.

Comment on lines +34 to +38
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably not enough, since you require a specific file name, and certainly a specific format.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should do as in the other CI steps (e.g., PHPstan), which are triggered by the presence of the config file and not a variable.

## Updating Your Plugin

To import the changes made to the _pluginsGLPI empty_ template into your project,
Expand Down