-
Notifications
You must be signed in to change notification settings - Fork 21
ci: add code coverage support #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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" | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
|
|
@@ -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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, | ||
|
|
||
There was a problem hiding this comment.
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