-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
57 lines (45 loc) · 1.19 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
API_DOCS_PATH = api/v1/docs
UI_PATH = ui
all: init test build
.PHONY: init
init: init-ui init-server
.PHONY: init-ui
init-ui:
@echo "> Installing the UI dependencies ..."
@cd ${UI_PATH} && yarn
.PHONY: init-server
init-server:
@echo "> Installing the server dependencies ..."
@go mod tidy -v
@go get -v ./...
@go install github.com/swaggo/swag/cmd/swag
.PHONY: test
test: test-ui test-server
.PHONY: test-ui
test-ui:
@echo "> Testing the UI source code ..."
@cd ${UI_PATH} && yarn test --coverage --watchAll=false
.PHONY: test-server
test-server:
@echo "> Testing the server source code ..."
@go test -cover -covermode atomic -coverprofile cover.out -race ./...
@go tool cover -func cover.out
.PHONY: build
build: build-ui build-server
.PHONY: build-ui
build-ui:
@echo "> Building the UI ..."
@cd ${UI_PATH} && rm -rf build && yarn build
.PHONY: build-server
build-server: gen-swagger
@echo "> Building the server binary ..."
@rm -rf bin && go build -o bin/patal .
.PHONY: lint-ui
lint-ui:
@echo "> Linting the UI source code ..."
@cd ${UI_PATH} && yarn lint
.PHONY: gen-swagger
gen-swagger:
@echo "Updating API documentation..."
@rm -rf ${API_DOCS_PATH}
@swag init -o ${API_DOCS_PATH}