[build] add code coverage to provider_integration workflow#352
Draft
zimmy87 wants to merge 17 commits into
Draft
[build] add code coverage to provider_integration workflow#352zimmy87 wants to merge 17 commits into
zimmy87 wants to merge 17 commits into
Conversation
…k in provider_integration workflow
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the repo’s xtask and CI workflow so the provider_integration GitHub Actions job runs integration tests under cargo llvm-cov and emits a coverage summary via xtask precheck --coverage-report.
Changes:
- Extend
xtask coverageto accept nextest-like arguments (features/package/profile/filterset/exclude) and forward them tocargo llvm-cov nextest. - Update
xtask precheckto pass coverage configuration (and to run multiple coverage invocations in the default “SDK” path). - Switch
provider_integrationworkflow steps from--nextestto--coverage, and add a coverage summary step.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
xtask/src/precheck.rs |
Routes precheck --coverage into parameterized Coverage runs (default SDK + resiliency runs, or user-provided package/features). |
xtask/src/coverage.rs |
Adds CLI flags to Coverage and builds argument lists for cargo llvm-cov nextest. |
.github/workflows/rust.yml |
Runs provider integration test packages with coverage and adds a coverage summary report step. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…g sdk-cov.json Agent-Logs-Url: https://github.com/Azure/azihsm-sdk/sessions/36ef3ca2-4175-4870-bd8a-2cfb4384dfc3 Co-authored-by: zimmy87 <5205889+zimmy87@users.noreply.github.com>
…h default precheck runs Agent-Logs-Url: https://github.com/Azure/azihsm-sdk/sessions/c036d7d2-3887-40af-8d85-48d245439a70 Co-authored-by: zimmy87 <5205889+zimmy87@users.noreply.github.com>
Comment on lines
+189
to
+202
| // append /target/debug/libazihsm_api_native.so to LLVM_COV_FLAGS | ||
| let additional_libs = ["./target/debug/libazihsm_api_native.so"]; | ||
| for lib in &additional_libs { | ||
| if std::path::Path::new(lib).exists() { | ||
| let new_flags = match std::env::var("LLVM_COV_FLAGS") { | ||
| Ok(existing) if !existing.trim().is_empty() => { | ||
| format!("{existing} -object {lib}") | ||
| } | ||
| _ => format!("-object {lib}"), | ||
| }; | ||
| sh.set_var("LLVM_COV_FLAGS", new_flags); | ||
| } else { | ||
| log::warn!("Could not find library at expected path: {}. Coverage reports may be incomplete.", lib); | ||
| } |
…n remaining test steps in provider_integration
…rt xtask behavior
Comment on lines
+73
to
+77
| let filterset_val = self.filterset.clone().unwrap_or_default(); | ||
| if self.filterset.is_some() { | ||
| command_args.push("--filterset"); | ||
| command_args.push(&filterset_val); | ||
| } |
Comment on lines
+96
to
+105
| // set LLVM_COV_FLAGS to include azihsm_api_native object file in coverage reports | ||
| if let Some(native_obj_path) = native_obj_path { | ||
| if native_obj_path.is_file() { | ||
| let path_str = native_obj_path.to_string_lossy(); | ||
| let new_flags = match std::env::var("LLVM_COV_FLAGS") { | ||
| Ok(existing) if !existing.trim().is_empty() => { | ||
| format!("{existing} -object {path_str}") | ||
| } | ||
| _ => format!("-object {path_str}"), | ||
| }; |
Comment on lines
+267
to
+276
| // Run resiliency fault-injection tests with coverage | ||
| Coverage { | ||
| features: Some("mock,res-test".to_string()), | ||
| package: Some("azihsm_api_tests".to_string()), | ||
| no_default_features: false, | ||
| filterset: Some("test(resiliency::fault_injection::)".to_string()), | ||
| profile: self.profile.clone().or(Some("ci-mock-res".to_string())), | ||
| exclude: self.exclude.clone(), | ||
| } | ||
| .run(ctx.clone())?; |
Comment on lines
+98
to
107
| // Run tests with coverage | ||
| log::info!("Building all tests and running them with coverage"); | ||
| cmd!( | ||
| sh, | ||
| "cargo llvm-cov report --json --summary-only --output-path ./target/reports/sdk-cov.json --ignore-filename-regex xtask*" | ||
| ).run()?; | ||
|
|
||
| // Generate HTML report | ||
| log::info!("Generating HTML report"); | ||
| cmd!(sh, " cargo llvm-cov report --html --output-dir ./target/reports/sdk-cov/ --ignore-filename-regex xtask*").run()?; | ||
| "cargo llvm-cov nextest --no-report --no-fail-fast {command_args...}" | ||
| ) | ||
| .run()?; | ||
|
|
||
| log::info!("Code coverage completed successfully"); | ||
| Ok(()) |
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.
No description provided.