-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
47 lines (32 loc) · 1.34 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
REGISTRY ?= docker.io
IMAGE ?= bborbe/git-sync
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
DIRS += $(shell find */* -maxdepth 0 -name Makefile -exec dirname "{}" \;)
default: precommit
build:
docker build --no-cache --rm=true --platform=linux/amd64 -t $(REGISTRY)/$(IMAGE):$(BRANCH) -f Dockerfile .
upload:
docker push $(REGISTRY)/$(IMAGE):$(BRANCH)
clean:
docker rmi $(REGISTRY)/$(IMAGE):$(BRANCH) || true
precommit: ensure format generate test check addlicense
@echo "ready to commit"
ensure:
go mod verify
go mod vendor
format:
go run -mod=vendor github.com/incu6us/goimports-reviser/v3 -project-name github.com/bborbe/git-sync -format -excludes vendor ./...
generate:
rm -rf mocks avro
go generate -mod=vendor ./...
test:
go test -mod=vendor -p=1 -cover -race $(shell go list -mod=vendor ./... | grep -v /vendor/)
check: vet errcheck vulncheck
vet:
go vet -mod=vendor $(shell go list -mod=vendor ./... | grep -v /vendor/)
errcheck:
go run -mod=vendor github.com/kisielk/errcheck -ignore '(Close|Write|Fprint)' $(shell go list -mod=vendor ./... | grep -v /vendor/)
addlicense:
go run -mod=vendor github.com/google/addlicense -c "Benjamin Borbe" -y $$(date +'%Y') -l bsd $$(find . -name "*.go" -not -path './vendor/*')
vulncheck:
go run -mod=vendor golang.org/x/vuln/cmd/govulncheck $(shell go list -mod=vendor ./... | grep -v /vendor/)