-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (50 loc) · 2.24 KB
/
Makefile
File metadata and controls
65 lines (50 loc) · 2.24 KB
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
GOBIN := $(shell pwd)/bin
SRC := $(shell find . -type f -name '*.go' -path "./pkg/f3/*")
VERSION := $(shell cat pkg/f3/version.go |grep "const Version ="|cut -d"\"" -f2)
LIBNAME := libf3
EXENAME := f3
build: FLAGS := -ldflags "-X github.com/xeus2001/interview-accountapi/pkg/f3.DefaultEndPoint=http://localhost:8080/v1"
docker: FLAGS := -ldflags "-X github.com/xeus2001/interview-accountapi/pkg/f3.DefaultEndPoint=http://accountapi:8080/v1"
release: FLAGS := -ldflags "-X github.com/xeus2001/interview-accountapi/pkg/f3.DefaultEndPoint=https://api.f3.tech/v1"
build: do-build
docker: do-build
release: check do-build
do-build: get
@echo "GOPATH: $(GOPATH)"
@echo "LDFLAGS: $(FLAGS)"
@echo "FILES: $(SRC)"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build $(FLAGS) -o bin/$(LIBNAME) cmd/main.go
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) GOOS=linux GOARCH=amd64 go build $(FLAGS) -o bin/$(EXENAME) cmd/main.go
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) GOOS=windows GOARCH=amd64 go build $(FLAGS) -o bin/$(EXENAME).exe cmd/main.go
doc: fmt
gomarkdoc --output doc/f3.md pkg/f3/*.go
swagger-ui:
chromium-browser \
--disable-web-security \
--user-data-dir="/tmp/chromium-debug/" \
'http://localhost:7080/#/Health/get_health' 'http://localhost:7080/#/Health/get_health'
fmt:
@echo $(SRC)
gofmt -w $(SRC)
check:
@sh -c "'$(CURDIR)/scripts/fmtcheck.sh'"
get:
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go get github.com/google/uuid
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go get golang.org/x/tools/cmd/cover
clean:
@rm -f bin/$(LIBNAME)
@rm -f bin/$(EXENAME)
@rm -f bin/$(EXENAME).exe
@rm -f coverage.out
@docker image rm f3.int.test:latest 2>/dev/null || true
simplify:
@gofmt -s -l -w $(SRC)
test:
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go test -cover -v github.com/xeus2001/interview-accountapi/pkg/f3
test-int:
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go test -cover -coverprofile=coverage.out -v -tags=int github.com/xeus2001/interview-accountapi/pkg/f3 -f3.endpoint=http://localhost:8080/v1
test-int-result:
@go tool cover -html=coverage.out
test-docker:
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go test -cover -v -tags=int github.com/xeus2001/interview-accountapi/pkg/f3 -f3.endpoint=http://accountapi:8080/v1
.PHONY: all build release do-build doc swagger-ui fmt check get clean simplify test test-int