diff --git a/.drone.yml b/.drone.yml index 0b1c8f7..c85dec9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,6 +21,7 @@ pipeline: - make vet - make lint # - make test + - make test-vendor - coverage all - make coverage - make build diff --git a/Makefile b/Makefile index b4195a7..76aeffc 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*") SOURCES ?= $(shell find . -name "*.go" -type f) TAGS ?= LDFLAGS ?= -X 'main.Version=$(VERSION)' +TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'tempdir') ifneq ($(shell uname), Darwin) EXTLDFLAGS = -extldflags "-static" $(null) @@ -39,6 +40,19 @@ fmt-check: exit 1; \ fi; +.PHONY: test-vendor +test-vendor: + @hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ + go get -u github.com/kardianos/govendor; \ + fi + govendor list +unused | tee "$(TMPDIR)/wc-gitea-unused" + [ $$(cat "$(TMPDIR)/wc-gitea-unused" | wc -l) -eq 0 ] || echo "Warning: /!\\ Some vendor are not used /!\\" + + govendor list +outside | tee "$(TMPDIR)/wc-gitea-outside" + [ $$(cat "$(TMPDIR)/wc-gitea-outside" | wc -l) -eq 0 ] || exit 1 + + govendor status || exit 1 + fmt: $(GOFMT) -w $(GOFILES)