forked from openflagr/flagr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (64 loc) · 2.15 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
PWD := $(shell pwd)
GOPATH := $(shell go env GOPATH)
UIPATH := $(PWD)/browser/flagr-ui
################################
### Public
################################
all: deps gen build build_ui run
rebuild: gen build
test: verifiers
@GO111MODULE=on go test -mod=vendor -race -covermode=atomic -coverprofile=coverage.txt github.com/checkr/flagr/pkg/...
ci: test
.PHONY: vendor
vendor:
@GO111MODULE=on go mod tidy
@GO111MODULE=on go mod vendor
build:
@echo "Building Flagr Server to $(PWD)/flagr ..."
@CGO_ENABLED=1 GO111MODULE=on go build -mod=vendor -o $(PWD)/flagr github.com/checkr/flagr/swagger_gen/cmd/flagr-server
build_ui:
@echo "Building Flagr UI ..."
@cd ./browser/flagr-ui/; npm install && npm run build
run:
@$(PWD)/flagr --port 18000
gen: api_docs swagger
deps: checks
@GO111MODULE=off go get -u github.com/myitcv/gobin
@gobin github.com/go-swagger/go-swagger/cmd/[email protected]
@gobin github.com/codeskyblue/fswatch
@gobin github.com/golangci/golangci-lint/cmd/[email protected]
@echo "Sqlite3" && sqlite3 -version
watch:
@fswatch
serve_docs:
@npm install -g docsify-cli@4
@docsify serve $(PWD)/docs
################################
### Private
################################
api_docs:
@echo "Installing swagger-merger" && npm install swagger-merger -g
@swagger-merger -i $(PWD)/swagger/index.yaml -o $(PWD)/docs/api_docs/bundle.yaml
checks:
@echo "Check deps"
@(env bash $(PWD)/buildscripts/checkdeps.sh)
verifiers: verify_lint verify_swagger
verify_lint:
@echo "Running $@"
@golangci-lint run -D errcheck ./pkg/...
verify_swagger:
@echo "Running $@"
@swagger validate $(PWD)/docs/api_docs/bundle.yaml
clean:
@echo "Cleaning up all the generated files"
@find . -name '*.test' | xargs rm -fv
@rm -rf build
@rm -rf release
swagger: verify_swagger
@echo "Regenerate swagger files"
@rm -f /tmp/configure_flagr.go
@cp $(PWD)/swagger_gen/restapi/configure_flagr.go /tmp/configure_flagr.go 2>/dev/null || :
@rm -rf $(PWD)/swagger_gen
@mkdir $(PWD)/swagger_gen
@swagger generate server -t ./swagger_gen -f $(PWD)/docs/api_docs/bundle.yaml
@cp /tmp/configure_flagr.go $(PWD)/swagger_gen/restapi/configure_flagr.go 2>/dev/null || :