1
0
mirror of https://github.com/siderolabs/kres.git synced 2026-02-05 09:45:35 +01:00

fix: codecov upload

Use the official codecov action, since the bash script is deprecated.
Also set a timeout on upload so we don't block other steps for too long.

Signed-off-by: Noel Georgi <git@frezbo.dev>
This commit is contained in:
Noel Georgi
2024-04-30 16:17:58 +05:30
parent ebc009dce3
commit d15226ef12
4 changed files with 30 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-04-20T16:39:33Z by kres add13d7.
# Generated on 2024-04-30T10:47:51Z by kres ebc009d-dirty.
name: default
concurrency:
@@ -61,8 +61,11 @@ jobs:
run: |
make unit-tests-race
- name: coverage
run: |
make coverage
uses: codecov/codecov-action@v4
with:
files: _out/coverage-unit-tests.txt
token: ${{ secrets.CODECOV_TOKEN }}
timeout-minutes: 3
- name: kres
run: |
make kres

View File

@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-04-15T15:29:32Z by kres cd31f0c.
# Generated on 2024-04-30T10:44:28Z by kres ebc009d-dirty.
# common variables
@@ -176,10 +176,6 @@ unit-tests: ## Performs unit tests
unit-tests-race: ## Performs unit tests with race detection enabled.
@$(MAKE) target-$@
.PHONY: coverage
coverage: ## Upload coverage data to codecov.io.
bash -c "bash <(curl -s https://codecov.io/bash) -f $(ARTIFACTS)/coverage-unit-tests.txt -X fix"
.PHONY: $(ARTIFACTS)/kres-darwin-amd64
$(ARTIFACTS)/kres-darwin-amd64:
@$(MAKE) local-kres-darwin-amd64 DEST=$(ARTIFACTS)

View File

@@ -25,6 +25,9 @@ const (
// CheckOutActionVersion is the version of checkout github action.
// renovate: datasource=github-releases extractVersion=^(?<version>v\d+)\.\d+\.\d+$ depName=actions/checkout
CheckOutActionVersion = "v4"
// CodeCovActionVersion is the version of codecov github action.
// renovate: datasource=github-releases extractVersion=^(?<version>v\d+)\.\d+\.\d+$ depName=codecov/codecov-action
CodeCovActionVersion = "v4"
// DeepCopyVersion is the version of deepcopy.
// renovate: datasource=go depName=github.com/siderolabs/deep-copy
DeepCopyVersion = "v0.5.6"

View File

@@ -6,6 +6,9 @@ package service
import (
"fmt"
"strings"
"github.com/siderolabs/gen/xslices"
"github.com/siderolabs/kres/internal/config"
"github.com/siderolabs/kres/internal/dag"
@@ -59,24 +62,28 @@ func (coverage *CodeCov) CompileGitHubWorkflow(output *ghworkflow.Output) error
return nil
}
output.AddStep("default", ghworkflow.MakeStep("coverage"))
paths := xslices.Map(coverage.InputPaths, func(path string) string {
return fmt.Sprintf("%s/%s", coverage.meta.ArtifactsPath, path)
})
output.AddStep(
"default",
&ghworkflow.Step{
Name: "coverage",
Uses: fmt.Sprintf("codecov/codecov-action@%s", config.CodeCovActionVersion),
With: map[string]string{
"files": strings.Join(paths, ","),
"token": "${{ secrets.CODECOV_TOKEN }}",
},
TimeoutMinutes: 3,
},
)
return nil
}
// CompileMakefile implements makefile.Compiler.
func (coverage *CodeCov) CompileMakefile(output *makefile.Output) error {
if !coverage.Enabled {
return nil
}
target := output.Target("coverage").Description("Upload coverage data to codecov.io.")
for _, inputPath := range coverage.InputPaths {
target.Script(fmt.Sprintf(`bash -c "bash <(curl -s https://codecov.io/bash) -f $(ARTIFACTS)/%s -X fix"`, inputPath)).
Phony()
}
func (coverage *CodeCov) CompileMakefile(_ *makefile.Output) error {
return nil
}