Skip to content

ci: Convert unit tests from Azure Pipelines to GitHub Actions#4298

Open
Copilot wants to merge 10 commits intomasterfrom
copilot/convert-azp-to-gh-workflow
Open

ci: Convert unit tests from Azure Pipelines to GitHub Actions#4298
Copilot wants to merge 10 commits intomasterfrom
copilot/convert-azp-to-gh-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

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:

  • Added a comprehensive .github/workflows/unit-tests.yml GitHub 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:

  • Updated TestPostNetworkContainersWithIPv6 in cns/restserver/api_test.go to 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.

Copilot AI linked an issue Mar 27, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Convert Azure Pipelines YAML to GitHub Actions workflow Convert unit tests from Azure Pipelines to GitHub Actions Mar 27, 2026
Copilot AI requested a review from jpayne3506 March 27, 2026 18:08
@jpayne3506 jpayne3506 requested a review from Copilot March 27, 2026 19:59
@jpayne3506
Copy link
Copy Markdown
Contributor

@copilot explain to me other options for irongut/CodeCoverageSummary usage and why you chose it.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 27, 2026

@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:

  1. irongut/CodeCoverageSummary@v1.3.0 (chosen) — Reads Cobertura XML directly and posts a formatted markdown table to the job summary and/or as a PR comment. No external service needed. Purpose-built for this format, which is exactly what gocov-xml produces. The issue brief also listed it as a first-choice replacement for PublishCodeCoverageResults@1.

  2. 5monkeys/cobertura-action — Similar scope (Cobertura → PR comment), but also annotates changed lines with coverage diff. Slightly heavier and less commonly maintained.

  3. codecov/codecov-action / coverallsapp/github-action — Upload coverage to Codecov.io or Coveralls.io (third-party SaaS). More powerful dashboards and trend tracking, but require external accounts, tokens, and introduce a dependency on an outside service the repo doesn't currently use.

  4. actions/upload-artifact only — Just archives the XML file; no automated summary or PR comment. Useful as a fallback but provides no visibility without manual download.

  5. dorny/test-reporter — Focused on test result reporting (JUnit XML) rather than code coverage; doesn't natively render Cobertura coverage summaries.

I picked irongut/CodeCoverageSummary because it is the closest self-contained equivalent to the AZP PublishCodeCoverageResults@1 task: it consumes Cobertura XML, requires no external service, and surfaces results directly in the PR/job summary — matching the original pipeline's intent with minimal added complexity.

Copy link
Copy Markdown
Contributor

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 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.

@jpayne3506 jpayne3506 added ci Infra or tooling. needs-backport Change needs to be backported to previous release trains release/1.5 Change affects v1.5 release train release/1.6 Change affects 1.6 release train release/1.7 Change affects v1.7 release train labels Mar 28, 2026
@jpayne3506 jpayne3506 changed the title Convert unit tests from Azure Pipelines to GitHub Actions ci: Convert unit tests from Azure Pipelines to GitHub Actions Mar 28, 2026
Comment on lines -2098 to +2108
// 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)
Copy link
Copy Markdown
Contributor

@jpayne3506 jpayne3506 Mar 28, 2026

Choose a reason for hiding this comment

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

Fix captures iterating through map with hard coded assertions. Maps do not have a deterministic ordering.

@jpayne3506 jpayne3506 requested a review from estebancams March 28, 2026 02:48
@jpayne3506 jpayne3506 marked this pull request as ready for review March 28, 2026 02:50
@jpayne3506 jpayne3506 requested review from a team as code owners March 28, 2026 02:50
@jpayne3506
Copy link
Copy Markdown
Contributor

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.

@jpayne3506
Copy link
Copy Markdown
Contributor

/azp run Azure Container Networking PR

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@jpayne3506 jpayne3506 enabled auto-merge March 28, 2026 03:01
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Infra or tooling. needs-backport Change needs to be backported to previous release trains release/1.5 Change affects v1.5 release train release/1.6 Change affects 1.6 release train release/1.7 Change affects v1.7 release train

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert UTs from AZP to GH Workflow

4 participants