ci: improve coverage upload reliability and observability - #19
Merged
Conversation
Agent-Logs-Url: https://github.com/Franchef/Semantic.NET/sessions/cd45efe6-2d7e-42ae-90c8-55591468495c Co-authored-by: Franchef <55815835+Franchef@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update CI workflow to improve coverage report handling
ci: improve coverage upload reliability and observability
May 9, 2026
Closed
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
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.
Both coverage upload steps lacked conditional execution, a token for Codecov auth, and useful diagnostics. Artifact path was too broad, with no retention policy.
Changes
Upload coverage reportif: always()— runs even on test failure for post-mortem debuggingpath: coverage/**/*.xml— scoped to actual coverage output instead of entirecoverage/dirif-no-files-found: warn— non-fatal when coverage files are absentretention-days: 7— bounded artifact storageUpload coverage to Codecovif: always()— consistent with artifact upload behaviortoken: ${{ secrets.CODECOV_TOKEN }}— explicit auth tokenverbose: true— surfacing upload diagnostics in CI logsOriginal prompt
Create a pull request in repository
Franchef/Semantic.NETthat updates the CI workflow at.github/workflows/ci.yml.Requirements:
copilot/fix-ci-coverage-uploadif possible, otherwise use an appropriate branch based on the provided base branch.Upload coverage reportstep to:if: always()uses: actions/upload-artifact@v5name: coverage-reportpathfromcoverage/tocoverage/**/*.xmlif-no-files-found: warnretention-days: 7Upload coverage to Codecovstep to:if: always()uses: codecov/codecov-action@v5token: ${{ secrets.CODECOV_TOKEN }}directory: coverage/fail_ci_if_error: falseverbose: truemain.The file currently being updated is
.github/workflows/ci.yml.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Suggest improvements to this code.
Assistant: A few small workflow smells stand out in this snippet:
Unconditional artifact upload
Upload coverage reportruns even if tests fail earlier, which can be wasteful or misleading depending on what files exist.if:.Very broad artifact path
coverage/blindly may include extra test result files, nested folders, or inconsistent output depending on howdotnet testwrites results.No artifact retention policy
retention-dayskeeps storage usage predictable.Recommended improvements
Option 1: Keep the current structure, but make it more explicit
This is the smallest improvement and fits GitHub Actions best practices well:
Why this is better
if: always()ensures upload still happens even if tests fail, which is useful for debugging partial results.pathis narrowed to likely coverage outputs instead of the whole directory.if-no-files-found: warnavoids failing the workflow just because coverage files weren’t generated.retention-days: 7reduces unnecessary artifact storage.Option 2: Upload only on success
If you only want artifacts when tests completed successfully, make that intent explicit:
When to choose this
Option 3: Simplify by removing the artifact step entirely
Since you already upload coverage to Codecov right after this, the artifact upload may be redundant unless you specifically want downloadable raw coverage files from GitHub Actions.
If you do not need manual download/debugging of coverage files, you could simplify to:
Why this may be better
Best-practice recommendation for this workflow
For a .NET CI pipeline, I’d recommend either:
If you keep the artifact step, this version is probably the best balance:
One more .NET-specific note: if you know the exact coverage format produced by
--collect:"XPlat Code Coverage"in your setup, you can make the path even more precise, for example:That’s usually the cleanest option for .NET test coverage output.
User: ```
use...
This pull request was created from Copilot chat.