mirror of
https://codeberg.org/cunicu/cunicu.git
synced 2025-09-26 21:01:14 +08:00
34 lines
905 B
Makefile
34 lines
905 B
Makefile
PKG = $(shell grep module go.mod | cut -f2 -d" ")
|
|
|
|
GIT_COMMIT = $(shell git rev-parse HEAD)
|
|
GIT_VERSION = $(shell git describe --tags --dirty || echo unknown)
|
|
|
|
LDFLAGS = -X main.version=$(GIT_VERSION) -X main.commit=$(GIT_COMMIT) -X main.date=$(shell date -Iseconds)
|
|
|
|
GINKGO_PKG ?= ./...
|
|
GINKGO_OPTS += --covermode=count --randomize-all $(GINKGO_EXTRA_OPTS) $(GINKGO_PKG) -- $(GINKGO_TEST_OPTS)
|
|
|
|
all: wice
|
|
|
|
wice:
|
|
go generate ./...
|
|
go build -o $@ -ldflags="$(LDFLAGS)" .
|
|
|
|
tests:
|
|
ginkgo run $(GINKGO_OPTS)
|
|
|
|
lcov.info: $(wildcard *.out)
|
|
@echo "Merging and converting coverage data..."
|
|
gocovmerge $(wildcard *.out) | gcov2lcov > $@
|
|
@echo "Done. $@ updated"
|
|
|
|
coverage: lcov.info
|
|
|
|
tests-watch:
|
|
( while inotifywait -qqe close_write --include "\.out$$" .; do $(MAKE) -sB coverage; done & )
|
|
ginkgo watch $(GINKGO_OPTS)
|
|
|
|
clean:
|
|
rm -f *.out wice lcov.info
|
|
|
|
.PHONY: all wice tests tests-watch coverage clean |