mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
Merge pull request #155 from nirmata/152_automate_testing
152 automate testing
This commit is contained in:
commit
4ce925ccf0
2 changed files with 33 additions and 2 deletions
|
@ -12,7 +12,8 @@ branches:
|
|||
install: true
|
||||
|
||||
script:
|
||||
- make build
|
||||
- make build || travis_terminate 1;
|
||||
- make test-all || travis_terminate 1;
|
||||
|
||||
after_script:
|
||||
- curl -d "repo=https://github.com/nirmata/kyverno" https://goreportcard.com/checks
|
||||
|
|
32
Makefile
32
Makefile
|
@ -55,4 +55,34 @@ docker-tag-repo:
|
|||
|
||||
docker-push:
|
||||
@docker push $(REPO):$(IMAGE_TAG)
|
||||
@docker push $(REPO):latest
|
||||
@docker push $(REPO):latest
|
||||
|
||||
## Testing & Code-Coverage
|
||||
|
||||
## variables
|
||||
BIN_DIR := $(GOPATH)/bin
|
||||
GO_ACC := $(BIN_DIR)/go-acc
|
||||
CODE_COVERAGE_FILE:= coverage
|
||||
CODE_COVERAGE_FILE_TXT := $(CODE_COVERAGE_FILE).txt
|
||||
CODE_COVERAGE_FILE_HTML := $(CODE_COVERAGE_FILE).html
|
||||
|
||||
## targets
|
||||
$(GO_ACC):
|
||||
@echo " downloading testing tools"
|
||||
go get -v github.com/ory/go-acc
|
||||
$(eval export PATH=$(GO_ACC):$(PATH))
|
||||
# go test provides code coverage per packages only.
|
||||
# go-acc merges the result for pks so that it be used by
|
||||
# go tool cover for reporting
|
||||
|
||||
# go get downloads and installs the binary
|
||||
# we temporarily add the GO_ACC to the path
|
||||
test-all: $(GO_ACC)
|
||||
@echo " running unit tests"
|
||||
go-acc ./... -o $(CODE_COVERAGE_FILE_TXT)
|
||||
|
||||
code-cov-report: $(CODE_COVERAGE_FILE_TXT)
|
||||
# transform to html format
|
||||
@echo " generating code coverage report"
|
||||
go tool cover -html=coverage.txt
|
||||
if [ -a $(CODE_COVERAGE_FILE_HTML) ]; then open $(CODE_COVERAGE_FILE_HTML); fi;
|
Loading…
Add table
Reference in a new issue