ci: add coverage check workflow#6582
ci: add coverage check workflow#65820xbigapple wants to merge 2 commits intotronprotocol:developfrom
Conversation
| if-no-files-found: error | ||
|
|
||
| upload-base-coverage: | ||
| name: Upload Base Coverage to Codecov |
There was a problem hiding this comment.
Base coverage should be queried first, and regenerated only if coverage for a corresponding commit is not found. This improves efficiency.
There was a problem hiding this comment.
Let’s clarify the roles of the two secrets that only access in tronprotocol environment:
secrets.CODECOV_TOKEN: used to upload coverage artifactssecrets.CODECOV_API_TOKEN: used to query coverage reports
Due to GitHub’s permission restrictions, secrets.CODECOV_API_TOKEN is not available in forked pull requests, which prevents querying the base repository’s coverage first.
In addition, the maintainers of java-tron have not configured secrets.CODECOV_API_TOKEN; only the upload token (secrets.CODECOV_TOKEN) is set.
| @@ -0,0 +1,58 @@ | |||
| name: Coverage Build | |||
There was a problem hiding this comment.
It is recommended to merge the PR code coverage workflow files.
There was a problem hiding this comment.
Codecov Upload & Compare runs in tron-protocol environment triggered by another workflow, but Coverage Build can only runs in user' environment.
| timeout-minutes: 70 | ||
|
|
||
| steps: | ||
| - name: Wait for codecov/project status |
There was a problem hiding this comment.
After uploading the coverage event, check whether it was successful.
There was a problem hiding this comment.
Workflow Codecov Upload & Compare replies on Coverage Build. If we merge Coverage Build and Waiting Coverage project, Codecov Upload & Compare can never be triggered.
Summary
This PR improves the CI pipeline by adding a complete coverage reporting workflow and reorganizing PR checks.
Changes
developandrelease_*branchescodecov.ymlconfiguration for project coverage checksCoverage Check Sequence Diagram(s)
sequenceDiagram participant GH as GitHub (PR Event) participant CGB as Coverage Build<br/>(PR Gen Artifact) participant AS as Artifact Storage participant CUP as Codecov Upload<br/>(PR Upload) participant CV as Codecov API participant CPW as Coverage Project<br/>(Waiting) GH->>CGB: Trigger on PR to develop/<br/>release_* CGB->>CGB: Checkout, setup JDK 8,<br/>build project CGB->>CGB: Generate JaCoCo<br/>reports CGB->>AS: Upload jacoco-coverage<br/>artifact CGB-->>CUP: Workflow complete signal CUP->>AS: Download jacoco-coverage<br/>artifact CUP->>GH: Fetch PR details<br/>(PR number, SHA, branch) CUP->>CV: Upload coverage data<br/>with PR context CV-->>CUP: Coverage upload<br/>acknowledged CPW->>CV: Poll codecov/project<br/>status (every 30s) CV-->>CPW: Return status<br/>(pending/success/failure) CPW->>CPW: Check legacy commit<br/>statuses & check-runs alt Status Success CPW-->>GH: Job succeeds else Status Failure CPW-->>GH: Job fails else Still Pending CPW->>CPW: Wait 30s,<br/>retry (max 120x) endNotes
The coverage comparison report only take effect starting from the next PR.