зеркало из https://github.com/mozilla/doorman.git
Add dedicated test-coverage make target
This commit is contained in:
Родитель
845fc4a01c
Коммит
6fe7933ee8
|
@ -1,4 +1,4 @@
|
|||
main
|
||||
utilities/bindata.go
|
||||
*.coverprofile
|
||||
coverage.txt
|
||||
policies.yaml
|
||||
|
|
|
@ -2,9 +2,7 @@ language: go
|
|||
|
||||
install:
|
||||
- go get github.com/mattn/goveralls
|
||||
- go get github.com/modocache/gover
|
||||
|
||||
script:
|
||||
- make test
|
||||
- gover
|
||||
- goveralls -coverprofile=gover.coverprofile -service=travis-ci
|
||||
- make test-coverage
|
||||
- goveralls -coverprofile=coverage.txt -service=travis-ci
|
||||
|
|
30
Makefile
30
Makefile
|
@ -1,12 +1,14 @@
|
|||
GO_LINT := $(GOPATH)/bin/golint
|
||||
GO_BINDATA := $(GOPATH)/bin/go-bindata
|
||||
DATA_FILES := ./utilities/openapi.yaml ./utilities/contribute.yaml
|
||||
SRC := *.go ./utilities/*.go ./warden/*.go
|
||||
PACKAGES := ./ ./utilities/ ./warden/
|
||||
|
||||
main: utilities/bindata.go *.go utilities/*.go warden/*.go
|
||||
CGO_ENABLED=0 go build -o main *.go
|
||||
main: utilities/bindata.go $(SRC)
|
||||
CGO_ENABLED=0 go build -o main $(SRC)
|
||||
|
||||
clean:
|
||||
rm -f main *.coverprofile utilities/bindata.go
|
||||
rm -f main coverage.txt utilities/bindata.go
|
||||
|
||||
$(GO_BINDATA):
|
||||
go get github.com/jteeuwen/go-bindata/...
|
||||
|
@ -24,18 +26,20 @@ $(GO_LINT):
|
|||
go get github.com/golang/lint/golint
|
||||
|
||||
lint: $(GO_LINT)
|
||||
$(GO_LINT) . ./utilities ./warden
|
||||
go vet . ./utilities ./warden
|
||||
|
||||
test: policies.yaml utilities/bindata.go lint
|
||||
go test -v -coverprofile=main.coverprofile -coverpkg=. .
|
||||
go test -v -coverprofile=warden.coverprofile -coverpkg=./warden ./warden
|
||||
go test -v -coverprofile=utilities.coverprofile -coverpkg=./utilities ./utilities
|
||||
# Exclude bindata.go from coverage.
|
||||
sed -i '/bindata.go/d' utilities.coverprofile
|
||||
$(GO_LINT) $(PACKAGES)
|
||||
go vet $(PACKAGES)
|
||||
|
||||
fmt:
|
||||
gofmt -w -s *.go ./utilities/*.go ./warden/*.go
|
||||
gofmt -w -s $(SRC)
|
||||
|
||||
test: policies.yaml utilities/bindata.go lint
|
||||
go test -v $(PACKAGES)
|
||||
|
||||
test-coverage: policies.yaml utilities/bindata.go
|
||||
# Multiple package coverage script from https://github.com/pierrre/gotestcover
|
||||
echo 'mode: atomic' > coverage.txt && go list ./... | grep -v /vendor/ | xargs -n1 -I{} sh -c 'go test -v -covermode=atomic -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.txt' && rm coverage.tmp
|
||||
# Exclude bindata.go from coverage.
|
||||
sed -i '/bindata.go/d' coverage.txt
|
||||
|
||||
docker-build: main
|
||||
docker build -t mozilla/iam .
|
||||
|
|
Загрузка…
Ссылка в новой задаче