ci: Convert unit tests from Azure Pipelines to GitHub Actions#4298
ci: Convert unit tests from Azure Pipelines to GitHub Actions#4298
Conversation
Agent-Logs-Url: https://github.com/Azure/azure-container-networking/sessions/65c859ae-cffd-4891-a71d-15c17aa8a992 Co-authored-by: jpayne3506 <89417863+jpayne3506@users.noreply.github.com>
|
@copilot explain to me other options for irongut/CodeCoverageSummary usage and why you chose it. |
The main alternatives for publishing Cobertura XML coverage in GitHub Actions are:
I picked |
There was a problem hiding this comment.
Pull request overview
This PR migrates the unit test pipeline from Azure Pipelines (.pipelines/templates/run-unit-tests.yaml) to a native GitHub Actions workflow, keeping the existing Linux test execution/coverage generation behavior and adding a coverage summary publishing step.
Changes:
- Adds a new GitHub Actions workflow to run unit tests on Linux and Windows.
- Produces and uploads per-OS coverage artifacts, and generates a Cobertura XML report from Linux coverage.
- Publishes a markdown coverage summary via
irongut/CodeCoverageSummary@v1.3.0.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ode propagation Agent-Logs-Url: https://github.com/Azure/azure-container-networking/sessions/22d6fdb8-35a0-4791-a1bc-8ea11a3b1464 Co-authored-by: jpayne3506 <89417863+jpayne3506@users.noreply.github.com>
| // Verify each NC has IPv6Configuration | ||
| for i, nc := range ncResponses.NetworkContainers { | ||
| assert.Equal(t, ncParamsWithIPv6[i].ipv6Config.IPSubnet.IPAddress, nc.IPv6Configuration.IPSubnet.IPAddress, "NC %d: IPv6 address mismatch", i) | ||
| assert.Equal(t, ncParamsWithIPv6[i].ipv6Config.GatewayIPAddress, nc.IPv6Configuration.GatewayIPAddress, "NC %d: IPv6 gateway mismatch", i) | ||
| // Verify each NC has IPv6Configuration (index by NC ID to avoid ordering assumptions) | ||
| ncByID := make(map[string]cns.GetNetworkContainerResponse, len(ncResponses.NetworkContainers)) | ||
| for _, nc := range ncResponses.NetworkContainers { | ||
| ncByID[nc.NetworkContainerID] = nc | ||
| } | ||
| for i, params := range ncParamsWithIPv6 { | ||
| ncID := "Swift_" + params.ncID | ||
| nc, ok := ncByID[ncID] | ||
| require.True(t, ok, "NC %d (%s) not found in response", i, ncID) | ||
| assert.Equal(t, params.ipv6Config.IPSubnet.IPAddress, nc.IPv6Configuration.IPSubnet.IPAddress, "NC %d: IPv6 address mismatch", i) | ||
| assert.Equal(t, params.ipv6Config.GatewayIPAddress, nc.IPv6Configuration.GatewayIPAddress, "NC %d: IPv6 gateway mismatch", i) |
There was a problem hiding this comment.
Fix captures iterating through map with hard coded assertions. Maps do not have a deterministic ordering.
|
After this runs for a little bit, I am in favor of removing UTs from AZP. This workflow would make them redundant. Hope is this takes 15-25 minutes off from the AZP PR pipeline. |
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| GOOS=linux gocov convert linux-coverage.out > linux-coverage.json | ||
| GOOS=linux gocov-xml < linux-coverage.json > linux-coverage.xml | ||
|
|
||
| # TODO: Add windows coverage back in once PublishCodeCoverageResults v2 works with BuildQualityChecks |
There was a problem hiding this comment.
If there's no equivalent for gh actions we can probably remove this (and the comment at the end). Also seems like irongut also has an option to fail below a threshold (I think it only checks total coverage?) but we can look into that later.
This pull request introduces a new GitHub Actions workflow for running unit tests and collecting code coverage across Linux and Windows environments. Additionally, it improves the reliability of IPv6 network container test assertions by making them independent of response order.
CI/CD Improvements:
.github/workflows/unit-tests.ymlGitHub Actions workflow that automates setup, testing, and code coverage reporting for both Linux (Ubuntu 22.04, 24.04) and Windows, including multi-module coverage aggregation and artifact uploads.Test Reliability Enhancements:
TestPostNetworkContainersWithIPv6incns/restserver/api_test.goto verify IPv6 configurations by network container ID rather than relying on response order, making the test more robust and less prone to false negatives due to ordering differences.