Skip to content

ci: use publish code coverage results v1 #3647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

QxBytes
Copy link
Contributor

@QxBytes QxBytes commented May 9, 2025

Reason for Change:

Use publish code coverage results v1 until v2 bug is fixed. Code coverage v1 does not support multi file coverage reports and merging the two files does not give the expected result (depending on the GOOS during gocov, os-specific files are included/excluded from the report).

Will re add the windows ut coverage after v2 fix is out.

Green run: https://msazure.visualstudio.com/One/_build/results?buildId=123636014&view=results

Issue Fixed:

Requirements:

Notes:

@QxBytes QxBytes self-assigned this May 9, 2025
@QxBytes QxBytes added the ci Infra or tooling. label May 9, 2025
@QxBytes QxBytes changed the title cit: use build quality checks v1 ci: use build quality checks v1 May 9, 2025
@QxBytes QxBytes changed the title ci: use build quality checks v1 ci: publish code coverage results v1 May 9, 2025
@QxBytes QxBytes changed the title ci: publish code coverage results v1 ci: use publish code coverage results v1 May 9, 2025
@QxBytes QxBytes marked this pull request as ready for review May 9, 2025 18:16
@Copilot Copilot AI review requested due to automatic review settings May 9, 2025 18:16
@QxBytes QxBytes requested a review from a team as a code owner May 9, 2025 18:16
@QxBytes QxBytes requested a review from carlotaarvela May 9, 2025 18:16
@QxBytes
Copy link
Contributor Author

QxBytes commented May 9, 2025

/azp run Azure Container Networking

Copy link

No pipelines are associated with this pull request.

Copy link
Contributor

@Copilot Copilot AI left a comment

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 updates the CI pipeline for Azure Container Networking to use Publish Code Coverage Results v1 instead of v2 due to multi-file report limitations and removes Windows coverage steps from the pipeline.

  • Removed Windows-specific pipeline tasks (artifact download, coverage conversion, and report migration).
  • Downgraded the publish code coverage task to version 1 and updated its configuration accordingly.
Comments suppressed due to low confidence (1)

.pipelines/templates/run-unit-tests.yaml:75

  • Removal of Windows coverage tasks means only Linux builds are covered; ensure this change aligns with the intended CI coverage requirements.
-              GOOS=windows gocov convert windows-coverage.out > windows-coverage.json

@QxBytes
Copy link
Contributor Author

QxBytes commented May 9, 2025

/azp run Azure Container Networking PR

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@pjohnst5 pjohnst5 left a comment

Choose a reason for hiding this comment

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

I think we should keep the windows test results, and combine them into one file (or does that not work?)

@@ -87,21 +82,18 @@ stages:
GOOS=linux gocov convert linux-coverage.out > linux-coverage.json
GOOS=linux gocov-xml < linux-coverage.json > linux-coverage.xml

GOOS=windows gocov convert windows-coverage.out > windows-coverage.json
GOOS=windows gocov-xml < windows-coverage.json > windows-coverage.xml
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should maybe consider combining these coverage files, like so:

mv linux-coverage.out total-coverage.out # rename to just total-coverage.out
sed -i "1d" windows-coverage.out  # removes first "mode: set" line from windows-coverage.out file
cat windows-coverage.out >> total-coverage.out
gocov convert total-coverage.out > total-coverage.json
gocov-xml < total-coverage.json > total-coverage.xml

This will combine them into one
If the windows coverage was there before, I don't think we should get rid of it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes I tried to use that method before using the multi file method but it seems like the coverage xml changes based on whether I GOOS=windows or GOOS=linux with gocov:
GOOS=windows gocov convert total_ut_coverage.out > total_ut_coverage.json will not include files like os_linux in the json/xml
GOOS=linux gocov convert total_ut_coverage.out > total_ut_coverage.json will not include files like os_windows in the json/xml
The coverage % also differ depending on whether it is GOOS=windows (.4743) or GOOS=linux (.4718)

Copy link
Member

Choose a reason for hiding this comment

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

We really need to pin down whether merging coverage like this is a "set union" operation or not. It doesn't seem like it is from what @QxBytes reports... that may be the source of some confusing results.

Copy link
Contributor

Choose a reason for hiding this comment

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

Alright yeah @QxBytes I see different behavior when:

  • Specifying GOOS=windows when converting the windows_coverage.out as opposed to GOOS=linux
  • Concatenating the windows_coverage.out to linux_coverage.out doesn't really add up
    • It only adds like ~2k lines to lines_covered, even though windows_coverage.xml showed ~5k lines covered (maybe they have overlap or something, like a common library between the two of them that gets tested twice, we already know if we have two duplicate lines in code coverage, the higest value is taken into account, regardless or ordering)

I'm attaching my *-coverage.xml and resulting coverage reports folders

Alexander, would you be able to see why the numbers are different? I think we don't understand fully yet why, and we may be able to get a more comprehensive look at the coverage overall if we can understand how combining them works
coverage_tests.zip

linuxcoverage:
image

wincoverage (GOOS was linux; default):
image

totalcoverage (concatenating windows_coverage.out to linux_coverage.out and running conversion commands with GOOS=linux (default):
image

winoscoverage (GOOS=windows on windows_coverage.out):
image

totaloscoverage(GOOS=windows after concatenating windows_coverage.out to linux_coverage.out):
image

These are the covered lines of each run:

Linux covered:12101
Win covered: 5044
Total covered: 12279

Win os covered: 5939
Total os covered: 10989

Copy link
Contributor Author

@QxBytes QxBytes May 16, 2025

Choose a reason for hiding this comment

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

They are inherently different based on whether you run the go cov with GOOS=windows or GOOS=linux. I believe based on the GOOS gocov will only take the lines that are for that os or are common to both-- so total w/ windows goos will take the .out file and only get the coverage that would be visible if it were a windows os, and same with linux. There isn't a set union based on what I can see. This is a limitation of gocov itself and we may be able to get multi-os reports again when the Publish Code Coverage v2 issue is fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay yeah that's fine, can you just leave a #TODO in there somewhere mentioning to add back in Windows code coverage when PCCRv2 works with BQC?

@QxBytes
Copy link
Contributor Author

QxBytes commented May 16, 2025

/azp run Azure Container Networking PR

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Infra or tooling.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants