Stabilize Codecov coverage and test-result reporting in CI#53
Conversation
Co-authored-by: dex3r <3155725+dex3r@users.noreply.github.com>
|
Also add this @copilot
|
... I can add it, but I can’t access that second image content from this environment. Please paste the exact text/snippet from the screenshot (or describe the setting you want added), and I’ll apply it right away in a follow-up commit. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
It says: In your CI YAML file, add below scripts to the end of your test run. |
Co-authored-by: dex3r <3155725+dex3r@users.noreply.github.com>
Implemented in commit |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
it looks like codecov is expecting JUnit, can dotnet nunit be used here? @copilot |
Co-authored-by: dex3r <3155725+dex3r@users.noreply.github.com>
Yes — NUnit on .NET can be used here. I fixed this in |
There was a problem hiding this comment.
Pull request overview
Updates the CI workflow to make Codecov uploads more reliable by using GitHub OIDC for coverage and by adding test-result reporting for the .NET test run.
Changes:
- Enable GitHub OIDC token issuance for the CI job and configure
codecov-action@v5to use OIDC. - Update
dotnet testto emit TRX results and add a TRX → JUnit conversion step. - Add
codecov/test-results-action@v1to upload converted test results.
Comments suppressed due to low confidence (1)
.github/workflows/ci.yml:46
- The workflow installs/updates the
trx2junitglobal tool before checking whether any*.trxfiles exist. If tests fail before producing results (or result logging is disabled later), this adds an unnecessary network step. Consider checking for TRX files first and only installing/updatingtrx2junitwhen conversion is actually needed.
if dotnet tool list --global | grep -q '^trx2junit '; then
dotnet tool update --global trx2junit --version 2.1.0
else
dotnet tool install --global trx2junit --version 2.1.0
fi
TRX_FILES="$(find ./coverage -type f -name '*.trx')"
if [ -n "$TRX_FILES" ]; then
trx2junit $TRX_FILES
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Upload test results to Codecov | ||
| if: ${{ !cancelled() }} | ||
| uses: codecov/test-results-action@v1 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| files: ./coverage/*.xml | ||
| disable_search: true |
There was a problem hiding this comment.
codecov/test-results-action is always executed, even when the previous step finds no TRX files (and therefore produces no JUnit XML). This can cause the workflow to fail or produce noisy Codecov errors like “No JUnit XML reports found”. Consider conditionally running this step only when converted JUnit files exist (e.g., have the conversion step set an output flag when it finds TRX/JUnit files and use that in the if: expression).
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| files: ./coverage/*.xml |
There was a problem hiding this comment.
This step relies on secrets.CODECOV_TOKEN, but on pull_request workflows secrets are not provided to runs from forked repositories. If a fork PR triggers this workflow, the token will be empty and the action may fail. Consider guarding the step with a token-present condition (or switching to an auth method that works for fork PRs).

Codecov reporting intermittently stopped attaching coverage to commits, resulting in missing commit-level status/details despite tests producing coverage files. The CI workflow was uploading in tokenless mode, which was rejected in failing runs.
Root cause
codecov-action@v5was executing without a token/OIDC path and failed withToken required - not valid tokenless uploadon affected runs.No JUnit XML reports foundbecause the .NET test run did not produce JUnit files by default.Workflow changes
permissions.id-token: writeuse_oidc: truecodecov/test-results-action@v1if: ${{ !cancelled() }}token: ${{ secrets.CODECOV_TOKEN }}files: ./coverage/*.xmldisable_search: true--logger "trx;LogFilePrefix=test-results"trx2junit 2.1.0*.trxfiles in./coverageResulting CI shape
> [!WARNING]
>
>
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.