Repository navigation
ci: report the coverage of a pull request as well - #550
Merged
Merged
Conversation
octocov v0.77.0 stores the report of a ref under a key of its own, so a run that is not on the default branch no longer overwrites the report diff.datastores: compares against. report.if: is_default_branch was what kept those runs from writing, and with it gone the coverage of a pull request is stored under default@refs_pull_N and stays readable afterwards. The comparison the comment shows is unchanged, since it still reads the report of the default branch. .octocov-full.yml keeps the condition. integration.yml runs it on pull_request_target, where GITHUB_REF names the base branch, and octocov resolves the pull request number of such a run through the head branch of an open pull request of the same repository. A fork's pull request therefore leaves the ref key empty and would store over the report the badge and the comparison read.
Contributor
Code Metrics Report
Details | | main (ce87951) | #550 (cb874b3) | +/- |
|---------------------|----------------|----------------|------|
| Coverage | 34.8% | 34.8% | 0.0% |
| Files | 32 | 32 | 0 |
| Lines | 3467 | 3467 | 0 |
| Covered | 1207 | 1207 | 0 |
| Code to Test Ratio | 1:0.9 | 1:0.9 | 0.0 |
| Code | 7118 | 7118 | 0 |
| Test | 6969 | 6969 | 0 |
- | Test Execution Time | 11s | 12s | +1s |Reported by octocov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
report.if: is_default_branchin.octocov.ymlmeans a pull request measures its coverage, comments it, and then throws the report away. Nothing is stored, so the coverage of a pull request cannot be looked at once the run is over.The condition had a reason. The artifact datastore held one report per key, so a run on any ref other than
mainstored under the samedefaultartifact name and overwrote the report thatdiff.datastores:compares against — the next pull request would then be diffed against another pull request rather than againstmain.k1LoW/octocov#720, released in v0.77.0, derives the artifact name from the ref: a pull request stores under
default@refs_pull_N, a branch underdefault@refs_heads_<name>, and the default branch keeps the baredefaultthatdiff.datastores:reads. The overwrite the condition guarded against can no longer happen, and #721 dropped the same line from the config octocov generates for a new repository.Change
Drop the line from
.octocov.yml. Everybuildrun stores its report from now on, while the comparison shown in the pull request comment is unchanged.Notes
.octocov-full.ymldeliberately keeps the condition.integration.ymlruns it onpull_request_target, whereGITHUB_REFnames the base branch rather than a pull request ref. octocov falls back to resolving the number from the head branch of an open pull request of the same repository, so for a pull request from a fork — which is the case theintegration-testlabel exists to serve — the number stays unresolved, the ref key comes out empty, and the report would be stored under the bareoctocov-reportthat the badge and the comparison read. Keeping the condition there leaves that alone; storing the full-test coverage of a pull request would need octocov to key apull_request_targetrun by its ref first..github/workflows/ci.ymlis untouched.octocov-action'sversion:input defaults tolatest, so v0.77.0 is already in use and the pinned action SHA does not hold octocov back.buildinvokes octocov once, so a run cannot store twice — which is the case octocov's own repository has to gate on the event name, since storing twice within one run makes octocov delete the artifact it wrote first, and that delete needs theactions: writea fork's token does not have.