From c8837fb92063ed02fc356d84e7a8cd788f34cb15 Mon Sep 17 00:00:00 2001 From: Jonas L Date: Mon, 15 Jul 2024 10:58:04 +0200 Subject: [PATCH] ci: update gitlab ci config (#661) - Cleanup outdated CI jobs. - Only run on feature branches. --- .gitlab-ci.yml | 54 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a7ee5b3e..441ba497 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,34 +1,44 @@ ---- include: - - project: cloud/operations/ci - file: k8s/release.yml - project: cloud/integrations/ci file: - default.yml - -stages: - - test - - e2e-test - - build - - release + - workflows/feature-branches.yml variables: - GOPROXY: goproxy.prodext.hcinfra.de - GONOSUMDB: hetzner.cloud + GOMODCACHE: $CI_PROJECT_DIR/.cache/go-mod + GOCACHE: $CI_PROJECT_DIR/.cache/go-build + +cache: + key: + files: + - go.mod + - go.sum + paths: + - $GOMODCACHE -unit: +build: + stage: build image: golang:1.22 + script: + - go env + - go mod download + +test:lint: stage: test + image: golangci/golangci-lint:v1.59 script: - - go test $(go list ./... | grep -v e2etests | grep -v integrationtests) -v + - golangci-lint run -v -e2e: - image: docker:git - stage: e2e-test - parallel: - matrix: - - K8S_VERSION: [k8s-1.23.15, k8s-1.24.9, k8s-1.25.5, k8s-1.26.0] - before_script: - - apk add --no-cache git make musl-dev go +test:unit: + stage: test + image: golang:1.22 script: - - go test $(go list ./... | grep e2etests) -v -timeout 60m + - go test -v -coverprofile=coverage.txt -covermode count ./... + - go get github.com/boumenot/gocover-cobertura + - go run github.com/boumenot/gocover-cobertura < coverage.txt > coverage.xml + artifacts: + reports: + coverage_report: + coverage_format: cobertura + path: coverage.xml + coverage: "/coverage: \\d+.\\d+% of statements/"