From b70c1d351b0a62f67e97fd08b34dbdbd80103384 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2024 15:01:44 +0100 Subject: [PATCH] Exclude the coverage files from the annotate step (#5773) (#6330) * Exclude the coverage files from the annotate step Signed-off-by: Alexandros Sapranidis (cherry picked from commit 8ebaa7d6dfb7ba9e87049e4a703755aeb4f642be) Co-authored-by: Alexandros Sapranidis --- .buildkite/pipeline.yml | 2 +- dev-tools/mage/gotest.go | 37 ------------------------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 35734f69ee7..c488c3a2fb5 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -160,7 +160,7 @@ steps: - label: ":junit: Junit annotate" plugins: - junit-annotate#v2.5.0: - artifacts: "build/*.xml" + artifacts: "**TEST-*.xml" always-annotate: true agents: provider: "gcp" diff --git a/dev-tools/mage/gotest.go b/dev-tools/mage/gotest.go index c061fbc75d1..11294caa333 100644 --- a/dev-tools/mage/gotest.go +++ b/dev-tools/mage/gotest.go @@ -5,7 +5,6 @@ package mage import ( - "bytes" "context" "errors" "fmt" @@ -341,42 +340,6 @@ func GoTest(ctx context.Context, params GoTestArgs) error { } } - // Generate an XML code coverage report. - var codecovReport string - if params.CoverageProfileFile != "" { - fmt.Println(">> go run gocover-cobertura:", params.CoverageProfileFile, "Started") - - // execute gocover-cobertura in order to create cobertura report - // install pre-requisites - installCobertura := sh.RunCmd("go", "install", "github.com/boumenot/gocover-cobertura@latest") - if err = installCobertura(); err != nil { - return fmt.Errorf("failed to install gocover-cobertura: %w", err) - } - - codecovReport = strings.TrimSuffix(params.CoverageProfileFile, - filepath.Ext(params.CoverageProfileFile)) + "-cov.xml" - - coverage, err := os.ReadFile(params.CoverageProfileFile) - if err != nil { - return fmt.Errorf("failed to read code coverage report: %w", err) - } - - coberturaFile, err := os.Create(codecovReport) - if err != nil { - return err - } - defer coberturaFile.Close() - - coverToXML := exec.Command("gocover-cobertura") - coverToXML.Stdout = coberturaFile - coverToXML.Stderr = os.Stderr - coverToXML.Stdin = bytes.NewReader(coverage) - if err = coverToXML.Run(); err != nil { - return fmt.Errorf("failed to write XML code coverage report: %w", err) - } - fmt.Println(">> go run gocover-cobertura:", params.CoverageProfileFile, "Created") - } - // Return an error indicating that testing failed. if goTestErr != nil { fmt.Println(">> go test:", params.LogName, "Test Failed")