-
Notifications
You must be signed in to change notification settings - Fork 265
Description
Task: Convert an Azure Pipelines YAML file to a GitHub Actions workflow for the azure-container-networking repository.
Source file: run-unit-tests.yaml
Output file: .github/workflows/unit-tests.yml (create this file)
Source pipeline summary:
The pipeline has three stages:
test (Linux): Runs on an Ubuntu pool. Steps: make bpf-lib, go generate master., make go-junit-report, then make test-all (with stdout piped through go-junit-report to produce report.xml and coverage files). Multiple coverage-*.out files are merged into linux-coverage.out, which is published as a pipeline artifact.
test_windows: Runs on a Windows pool. Runs go test -timeout 30m -covermode atomic -coverprofile=windows-coverage.out ./cns/... ./npm/... ./cni/... azure-container-networking. and publishes windows-coverage.out as an artifact.
code_coverage: Downloads linux-coverage artifact, runs make workspace, make tools, installs gocov/gocov-xml, converts linux-coverage.out to Cobertura XML, publishes the coverage report, and runs BuildQualityChecks@8 to enforce coverage regression checks on PRs targeting master.
Requirements:
Linux unit test job: Use ubuntu-24.04 runners. Reproduce the full Linux test step faithfully: make bpf-lib, go generate master., then run make test-all capturing output for both junit and coverage. Upload linux-coverage.out as a workflow artifact. Add retryCountOnTaskFailure: 3 equivalent using continue-on-error or a retry action if appropriate.
Windows unit test job: Use windows-latest runners. Reproduce the Windows test step: run the go test command from the repo root (no cd azure-container-networking/ needed since the repo checkout puts us there). Upload windows-coverage.out as a workflow artifact.
Code coverage job: Download the linux-coverage artifact, run the make workspace, make tools, gocov conversion steps, and publish the Cobertura XML using the irongut/CodeCoverageSummary action or actions/upload-artifact + dorny/test-reporter as best-effort replacements. The BuildQualityChecks@8 Azure DevOps task has no direct GitHub Actions equivalent — note this limitation in a comment in the workflow file and skip that step.
Trigger: Run on push to master and on pull_request targeting master.
Structure: The Linux and Windows test jobs should run in parallel. The code coverage job should needs the Linux test job (mirroring the dependsOn in the original pipeline).
General: Use actions/checkout@v4 for checkout. Infer the Go version from go.mod in the repo root (read the file to find the go directive). Do not add steps not present in the original pipeline. Preserve the sudo -E env "PATH=$PATH" pattern in the Linux test step as-is since it's needed for privilege escalation.