chore(ci): add golang tests
This commit is contained in:
parent
5eec7fc1a5
commit
3482c952e9
24
.gitea/workflows/golang-tests.yml
Normal file
24
.gitea/workflows/golang-tests.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
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:
|
||||||
|
GONOSUMDB: ${{ vars.GONOSUMDB }}
|
||||||
|
GOPROXY: ${{ vars.GOPROXY }}
|
||||||
|
run: make test/unit
|
18
Makefile
18
Makefile
@ -26,11 +26,8 @@ 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) \
|
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,15 +40,24 @@ clean:
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=test/unit
|
PHONY+=test/unit
|
||||||
test/unit:
|
test/unit:
|
||||||
go test -v -p 1 -coverprofile=coverage.txt -covermode=count -timeout 1200s ./pkg/...
|
CGO_ENABLED=0 \
|
||||||
|
GOPROXY=$(shell go env GOPROXY) \
|
||||||
|
GONOSUMDB=$(shell go env GONOSUMDB) \
|
||||||
|
go test -v -p 1 -coverprofile=coverage.txt -covermode=count -timeout 1200s ./pkg/...
|
||||||
|
|
||||||
PHONY+=test/integration
|
PHONY+=test/integration
|
||||||
test/integration:
|
test/integration:
|
||||||
go test -v -p 1 -count=1 -timeout 1200s ./it/...
|
CGO_ENABLED=0 \
|
||||||
|
GOPROXY=$(shell go env GOPROXY) \
|
||||||
|
GONOSUMDB=$(shell go env GONOSUMDB) \
|
||||||
|
go test -v -p 1 -count=1 -timeout 1200s ./it/...
|
||||||
|
|
||||||
PHONY+=test/coverage
|
PHONY+=test/coverage
|
||||||
test/coverage: test/unit
|
test/coverage: test/unit
|
||||||
go tool cover -html=coverage.txt
|
CGO_ENABLED=0 \
|
||||||
|
GOPROXY=$(shell go env GOPROXY) \
|
||||||
|
GONOSUMDB=$(shell go env GONOSUMDB) \
|
||||||
|
go tool cover -html=coverage.txt
|
||||||
|
|
||||||
# GOLANGCI-LINT
|
# GOLANGCI-LINT
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user