Skip to content

Integrate code coverage into rust.yml and remove pr-coverage workflow#1602

Merged
SteveL-MSFT merged 2 commits into
mainfrom
stevel-msft-codecoverage-in-rust-yml
Jun 28, 2026
Merged

Integrate code coverage into rust.yml and remove pr-coverage workflow#1602
SteveL-MSFT merged 2 commits into
mainfrom
stevel-msft-codecoverage-in-rust-yml

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

The separate pr-coverage.yml workflow duplicated most of the build/test work already performed by rust.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

  • All three platform build jobs (linux, macos, windows) now run rust tests with -CodeCoverage, producing an lcov.info artifact alongside the existing bin.tar build artifact.
  • A new coverage-report job runs after all build and pester jobs complete. It downloads the coverage artifacts, picks the first available lcov.info, analyzes coverage on changed Rust files using the existing Get-CodeCoverageReport helper, and posts a sticky PR comment in the same format as before.
  • pr-coverage.yml is deleted since rust.yml now owns that responsibility.

Notes

  • build.ps1 -CodeCoverage continues to work locally with no changes -- the PowerShell scripts were not modified.
  • fetch-depth: 0 was added to checkout steps in the build jobs so the coverage consolidation job can perform git diff analysis against the PR base.
  • Coverage artifact upload uses if-no-files-found: ignore and if: always() so a test failure does not block the bin artifact upload or other jobs.

- 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>
Copilot AI review requested due to automatic review settings June 28, 2026 02:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 -CodeCoverage on Linux/macOS/Windows builds and upload lcov.info as an artifact per platform.
  • Add a coverage-report job that downloads coverage artifacts, computes changed-Rust coverage via Get-CodeCoverageReport, and posts a sticky PR comment.
  • Delete the redundant .github/workflows/pr-coverage.yml workflow.

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.

Comment thread .github/workflows/rust.yml
Comment thread .github/workflows/rust.yml
Comment thread .github/workflows/rust.yml
Comment thread .github/workflows/rust.yml
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>
@github-actions

Copy link
Copy Markdown

Code Coverage Report

No Rust files were changed in this PR. Coverage analysis skipped.

@SteveL-MSFT SteveL-MSFT merged commit f10641f into main Jun 28, 2026
24 checks passed
@SteveL-MSFT SteveL-MSFT deleted the stevel-msft-codecoverage-in-rust-yml branch June 28, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants