You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
9
9
The format of this change log follows the advice given at [Keep a CHANGELOG](http://keepachangelog.com).
10
10
11
11
## [Unreleased]
12
+
### Fixed
13
+
- Updated to `php-coveralls/php-coveralls` v2 for uploading coverage results to [Coveralls](https://coveralls.io) with the `coveralls-upload` command.
14
+
- ACTION REQUIRED: Review any use of the `coveralls-upload` command in GHA and ensure that `COVERALLS_REPO_TOKEN` is set in the environment. See [Coveralls integration](https://github.com/moodlehq/moodle-plugin-ci/blob/master/docs/CodeCoverage.md#coveralls-integration) for more information.
Copy file name to clipboardExpand all lines: docs/CodeCoverage.md
+20-5Lines changed: 20 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Code coverage will now automatically fallback between `pcov` => `xdebug` => `php
10
10
11
11
The way you generate code coverage is to use one of the coverage options on the `phpunit` command. The currently
12
12
available options are `--coverage-text` and `--coverage-clover`. The easiest way to start generating code coverage
13
-
is to use the text option as that gets printed in the Travis CI logs. Example:
13
+
is to use the text option as that gets printed in the CI logs. Example:
14
14
15
15
```yaml
16
16
script:
@@ -42,9 +42,24 @@ If you would like to use Coveralls, then go to https://coveralls.io and login wi
42
42
need to authorize access to your public repositories. Once you have done that, navigate to your
43
43
[REPOS](https://coveralls.io/repos) listing and use the _ADD REPOS_ button in the upper right to turn on your project.
44
44
45
-
Then, you need to make the following changes to your plugin's `.travis.yml` file. You need to tell the `phpunit`
46
-
command to generate clover coverage and then use the `coveralls-upload` command to actually upload the coverage.
47
-
Example:
45
+
Then, you need to instruct to your favourite CI tool, so the `phpunit` command generates the clover coverage file and, then, use the `coveralls-upload` command to actually upload the coverage.
46
+
47
+
Some examples follow:
48
+
49
+
#### GitHub Actions
50
+
51
+
```yaml
52
+
- name: PHPUnit tests
53
+
if: ${{ always() }}
54
+
run: |
55
+
moodle-plugin-ci phpunit --coverage-clover
56
+
moodle-plugin-ci coveralls-upload
57
+
env:
58
+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59
+
```
60
+
Note that, instead of the automatically generated for every run `${{ secrets.GITHUB_TOKEN }}` token you can use any other GitHub token (PAT...) with the correct perms or, also, the token that Coveralls offers to you for every repository. Just it's easier to use the automatic GitHub one, because that way you don't need to create tokens or secrets manually and maintain them.
61
+
62
+
#### Travis
48
63
49
64
```yaml
50
65
script:
@@ -61,4 +76,4 @@ will be updated with a new coverage report.
61
76
62
77
**Tips on troubleshooting:** if you are having problems with sending coverage to Coveralls, do not forget that you
63
78
can expand the `coveralls-upload` line in the Travis CI logs where there might be some details as to why. Also don't
64
-
forget that coverage is only generated for PHP7 or later and this applies to the Coveralls integration as well.
79
+
forget that coverage is only generated for PHP7 or later and this applies to the Coveralls integration as well.
0 commit comments