chore(ci): add golang tests
All checks were successful
Golang Tests / unittest (push) Successful in 42s
Markdown linter / markdown-lint (push) Successful in 12s

This commit is contained in:
Markus Pesch 2025-04-14 19:22:50 +02:00
parent 5eec7fc1a5
commit 6387e972e3
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
2 changed files with 32 additions and 7 deletions

View File

@ -0,0 +1,23 @@
name: Golang Tests
on:
pull_request:
types: [ "opened", "reopened", "synchronize" ]
push:
branches:
- '**'
tags-ignore:
- '**'
jobs:
unittest:
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-go@v5.4.0
with:
go-version: stable
- env:
GOPROXY: ${{ vars.GOPROXY }}
run: make test/unit

View File

@ -26,11 +26,7 @@ DCMERGE_IMAGE_UNQUALIFIED=${DCMERGE_IMAGE_NAMESPACE}/${DCMERGE_IMAGE_NAME}:${DCM
# ============================================================================== # ==============================================================================
dcmerge: dcmerge:
CGO_ENABLED=0 \ CGO_ENABLED=0 \
GOPRIVATE=$(shell go env GOPRIVATE) \
GOPROXY=$(shell go env GOPROXY) \ GOPROXY=$(shell go env GOPROXY) \
GONOPROXY=$(shell go env GONOPROXY) \
GONOSUMDB=$(shell go env GONOSUMDB) \
GOSUMDB=$(shell go env GOSUMDB) \
go build -ldflags "-X 'main.version=${VERSION}'" -o ${@} main.go go build -ldflags "-X 'main.version=${VERSION}'" -o ${@} main.go
# CLEAN # CLEAN
@ -43,14 +39,20 @@ clean:
# ============================================================================== # ==============================================================================
PHONY+=test/unit PHONY+=test/unit
test/unit: test/unit:
CGO_ENABLED=0 \
GOPROXY=$(shell go env GOPROXY) \
go test -v -p 1 -coverprofile=coverage.txt -covermode=count -timeout 1200s ./pkg/... go test -v -p 1 -coverprofile=coverage.txt -covermode=count -timeout 1200s ./pkg/...
PHONY+=test/integration PHONY+=test/integration
test/integration: test/integration:
CGO_ENABLED=0 \
GOPROXY=$(shell go env GOPROXY) \
go test -v -p 1 -count=1 -timeout 1200s ./it/... go test -v -p 1 -count=1 -timeout 1200s ./it/...
PHONY+=test/coverage PHONY+=test/coverage
test/coverage: test/unit test/coverage: test/unit
CGO_ENABLED=0 \
GOPROXY=$(shell go env GOPROXY) \
go tool cover -html=coverage.txt go tool cover -html=coverage.txt
# GOLANGCI-LINT # GOLANGCI-LINT