diff options
| author | Shulhan <ms@kilabit.info> | 2024-04-06 16:39:26 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-04-06 16:39:39 +0700 |
| commit | 3c550af069f30bed846ac012457a88b65223306d (patch) | |
| tree | e8e712360c8cd7bcf4955c1ae1424c2625138932 | |
| parent | 772747f4051085443b38db8fb8f01ada41e89fc5 (diff) | |
| download | kbbi-3c550af069f30bed846ac012457a88b65223306d.tar.xz | |
all: run test with coverage
Running "make test" now print and generate the coverage in text and
HTML format.
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | Makefile | 17 |
2 files changed, 15 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..18aad36 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/cover.html +/cover.txt @@ -2,15 +2,24 @@ ## Use of this source code is governed by a BSD-style ## license that can be found in the LICENSE file. -.PHONY: all install +.PHONY: all +all: test lint install -all: test check install +COVER_TXT:=cover.txt +COVER_HTML:=cover.html + +.PHONY: test +test: CGO_ENABLED=1 test: - go test -v ./... + go test -failfast -timeout=1m -race -coverprofile=$(COVER_TXT) ./... + go tool cover -html=$(COVER_TXT) -o $(COVER_HTML) + -check: +.PHONY: lint +lint: golangci-lint run ./... +.PHONY: install install: go install ./cmd/kamusku |
