Closed cicdguy closed 2 years ago
Filename Stmts Miss Cover Missing
-------------------- ------- ------ ------- ---------------
all_lines_covered.py 10 0 100.00%
miss_at_start.py 10 2 80.00% 1-3
miss_at_end.py 10 2 80.00% 9-10
single_line_gaps.py 10 3 70.00% 3, 5, 9
multi_line_gaps.py 10 7 30.00% 4-5, 7-9, 15-18
unsorted_lines.py 10 5 50.00% 4, 3, 8-9, 6
no_lines.py 0 0 0.00%
single_line.py 1 1 0.00% 4
TOTAL 61 20 51.25%
Results for commit: 692eb7c409a1b675a38ea0deaf04ee29482f2264
Minimum allowed coverage is 50%
:recycle: This comment has been updated with latest results
Filename Stmts Miss Cover Missing
------------------------------ ------- ------ ------- ---------
Main.java 11 0 100.00%
search/BinarySearch.java 12 1 91.67% 24
search/ISortedArraySearch.java 0 0 100.00%
search/LinearSearch.java 7 2 71.43% 19-24
TOTAL 30 3 90.00%
Results for commit: 692eb7c409a1b675a38ea0deaf04ee29482f2264
Minimum allowed coverage is 90%
:recycle: This comment has been updated with latest results
Example of comment where the code coverage is worse than on main: https://github.com/insightsengineering/r.pkg.template/pull/100#issuecomment-1195199696
Looks good so far. What happens to repositories which do not have the branch which stores the badges and coverage reports? Does the action create a new, empty orphan branch? If not, it should.
Yeah, an orphan branch is created here. By empty do you mean that only the badge and the report should exist on this branch? Or can other files be there as well?
Yeah, an orphan branch is created here. By empty do you mean that only the badge and the report should exist on this branch? Or can other files be there as well?
Alright, that's great.
As for other files being there, presumably the only other files and directories that should be there would be directories named after branches whose content is the XML and the SVG. A README.md at the top level is fine, but none of the original repository contents should be there for minimizing git storage.
Example of PR with comparison of code coverage: https://github.com/walkowif/tern/pull/3
Contents of _xml_coverage_reports
branch: https://github.com/walkowif/tern/tree/_xml_coverage_reports
|| github.event_name == 'push'
has to be added to coverage
job, if one wants to generate the code coverage badge (for main
) and updated coverage report on main
.
For example:
coverage:
if: github.event_name == 'pull_request' || github.event_name == 'push'
name: Coverage 📔
uses: insightsengineering/r.pkg.template/.github/workflows/test-coverage.yaml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
publish-coverage-report: true
I noted is that the action doesn't store the XML coverage reports for the current branch in the _xml_coverage_reports
branch.
So this is the directory structure that I was expecting:
🪵 _xml_coverage_reports
❯ tree
.
├── README.md
├── branch_1
│ ├── badge.svg
│ └── coverage.xml
├── branch_2
│ ├── badge.svg
│ └── coverage.xml
├── branch_3
│ ├── badge.svg
│ └── coverage.xml
├── branch_N
│ ├── badge.svg
│ └── coverage.xml
├── main
│ ├── badge.svg
│ └── coverage.xml
├── pre-release
│ ├── badge.svg
│ └── coverage.xml
└── some-other-branch
├── badge.svg
└── coverage.xml
Instead it looks like this:
🪵 _xml_coverage_reports
❯ tree
.
├── README.md
├── badges
│ ├── branch_1
│ │ └── badge.svg
│ ├── branch_2
│ │ └── badge.svg
│ ├── branch_3
│ │ └── badge.svg
│ ├── branch_N
│ │ └── badge.svg
│ ├── main
│ │ └── badge.svg
│ ├── pre-release
│ │ └── badge.svg
│ └── some-other-branch
│ └── badge.svg
└── coverage-report-action
└── coverage.xml # Where this only exists for the most recent run
For provenance and posterity purposes, it's best to also retain the coverage reports for the feature branches. This way if someone wants to manually do a diff across 2 branches, they will be able to do so.
The _xml_coverage_reports
branch now stores the reports for each feature branch. They have to be inside a directory with a known name (I chose data
), because otherwise it will not be possible to clean the repo while initializing the storage branch.
Bugfixes for v2