Integrate code coverage into rust.yml and remove pr-coverage workflow#1602
Merged
Conversation
- Enable code coverage on all platform build jobs (linux, macos, windows) by using -CodeCoverage flag with rust tests - Add fetch-depth: 0 to checkout steps for coverage diff analysis - Upload lcov.info as coverage artifacts from each platform - Add coverage-report consolidation job that runs on PRs after all tests complete, analyzes changed-file coverage, and posts results as a sticky PR comment using the same format as the old workflow - Remove the standalone pr-coverage.yml workflow (now redundant) No changes to build.ps1 or helpers.build.psm1 - local `build.ps1 -CodeCoverage` continues to work as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates Rust PR code-coverage reporting into the existing .github/workflows/rust.yml pipeline and removes the standalone pr-coverage.yml workflow to avoid duplicating CI work.
Changes:
- Run Rust tests with
-CodeCoverageon Linux/macOS/Windows builds and uploadlcov.infoas an artifact per platform. - Add a
coverage-reportjob that downloads coverage artifacts, computes changed-Rust coverage viaGet-CodeCoverageReport, and posts a sticky PR comment. - Delete the redundant
.github/workflows/pr-coverage.ymlworkflow.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .github/workflows/rust.yml | Adds coverage generation + artifact upload to existing build jobs and introduces a consolidated PR coverage-report comment job. |
| .github/workflows/pr-coverage.yml | Removes the now-redundant standalone PR coverage workflow. |
Use continue-on-error on the rust test step with a deferred failure check at the end of each build job. Mark artifact upload steps with if: always() so coverage data and bin.tar are always uploaded regardless of test outcome. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Code Coverage ReportNo Rust files were changed in this PR. Coverage analysis skipped. |
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.
The separate
pr-coverage.ymlworkflow duplicated most of the build/test work already performed byrust.yml, adding CI time on every PR without reusing any of the existing test results. This change consolidates code coverage into the main Rust workflow so coverage data is collected as a natural byproduct of the tests that already run.Approach
-CodeCoverage, producing anlcov.infoartifact alongside the existingbin.tarbuild artifact.coverage-reportjob runs after all build and pester jobs complete. It downloads the coverage artifacts, picks the first availablelcov.info, analyzes coverage on changed Rust files using the existingGet-CodeCoverageReporthelper, and posts a sticky PR comment in the same format as before.pr-coverage.ymlis deleted sincerust.ymlnow owns that responsibility.Notes
build.ps1 -CodeCoveragecontinues to work locally with no changes -- the PowerShell scripts were not modified.fetch-depth: 0was added to checkout steps in the build jobs so the coverage consolidation job can perform git diff analysis against the PR base.if-no-files-found: ignoreandif: always()so a test failure does not block the bin artifact upload or other jobs.