forked from korrel8r/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (40 loc) · 1.25 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
48
49
50
51
52
53
54
55
all: lint test build
VERSION=0.0.3
include .bingo/Variables.mk
VERSION_TXT=pkg/build/version.txt
SWAGGER_SPEC=swagger.json
SWAGGER_CLIENT=pkg/swagger
KORREL8RCLI=./korrel8rcli
lint: $(SWAGGER_CLIENT) $(GOLANGCI_LINT)
go mod tidy
$(GOLANGCI_LINT) run ./...
@if grep -q github.com/korrel8r/korrel8r go.mod; then \
echo "ERROR: bad dependency: remove 'github.com/korrel8r/korrel8r' from go.mod"; \
exit 1; \
fi
build: $(KORREL8RCLI)
$(KORREL8RCLI): $(VERSION_TXT) $(SWAGGER_CLIENT)
go build -o $@ ./cmd/korrel8rcli
test:
go test -cover -race ./...
go tool covdata percent -i pkg/cmd/_covdata
clean:
rm -rfv $(SWAGGER_CLIENT) $(SWAGGER_SPEC) $(KORREL8RCLI)
git clean -dfx
run:
go run ./cmd/korrel8rcli web
ifneq ($(VERSION),$(file <$(VERSION_TXT)))
.PHONY: $(VERSION_TXT) # Force update if VERSION_TXT does not match $(VERSION)
endif
$(VERSION_TXT): $(MAKEFILE_LIST)
echo $(VERSION) > $@
$(SWAGGER_SPEC): $(KORREL8R) ## Use bingo-installed korrel8r to generate spec.
$(KORREL8R) web --spec $@
$(SWAGGER_CLIENT): $(SWAGGER_SPEC) $(SWAGGER) ## Generate client packages.
@mkdir -p $@
cd $@ && $(SWAGGER) generate -q client -f $(abspath $(SWAGGER_SPEC))
go mod tidy
touch $@
pre-release: all
release: pre-release
hack/tag-release.sh $(VERSION)