-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·96 lines (78 loc) · 2.8 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
86
87
88
89
90
91
92
93
94
95
96
.PHONY: all
all: dep gen build test lint
.PHONY: clean
clean:
find ./ -name '*.generated.go' -type f -delete
rm -rf ./onix
rm -rf ./frontend/dashboard-admin/build/ || true
rm -rf ./frontend/dashboard-admin/node_modules/ || true
rm -rf ./frontend/dashboard-main/build/ || true
rm -rf ./frontend/dashboard-main/node_modules/ || true
rm -f ./coverage.out
rm -rf internal/repository/mocks || true
rm -rf internal/service/mocks || true
.PHONY: dep
dep:
@echo "Install backend dependencies"
go mod download
go mod tidy
@echo "Install frontend dependencies"
npm --prefix ./frontend/dashboard-admin/ install
npm --prefix ./frontend/dashboard-main/ install
.PHONY: gen
gen:
@echo "Generate backend boilerplate code"
go generate ./...
.PHONY: gen/frontend/snapshot
gen/frontend/snapshot:
@echo "Generate jest test snapshots"
npm --prefix ./frontend/dashboard-admin/ test -- -u --watchAll=false
npm --prefix ./frontend/dashboard-main/ test -- -u --watchAll=false
.PHONY: build
build: build/backend build/frontend
.PHONY: build/backend
build/backend:
@echo "Build backend"
CGO_ENABLED=0 go build ./
.PHONY: build/frontend
build/frontend:
@echo "Build frontend"
npm --prefix ./frontend/dashboard-admin/ run build
npm --prefix ./frontend/dashboard-main/ run build
.PHONY: test
test: test/backend test/frontend
.PHONY: test/backend
test/backend:
go test -race ./...
.PHONY: test/frontend
test/frontend:
npm --prefix ./frontend/dashboard-admin/ test -- --watchAll=false
npm --prefix ./frontend/dashboard-main/ test -- --watchAll=false
.PHONY: lint
lint:
golangci-lint run
ineffassign ./...
find . -type f -name '*.go' | xargs misspell -error
cd ./frontend/dashboard-main/ && eslint src/**/*.js && cd ./../../
.PHONY: benchmark
benchmark:
go test -gcflags="-N" ./... -bench=.
.PHONY: coverage
coverage:
go test -race -coverprofile=./coverage.out ./...
go tool cover -html ./coverage.out
.PHONY: image
image:
echo "Build"
docker build --pull --network=host -f ./.build/register/Dockerfile -t docker.io/goforbroke1006/onix-register:latest ./.build/register
DOCKER_BUILDKIT=1 docker build --pull --network=host -f .build/backend/Dockerfile -t docker.io/goforbroke1006/onix-backend:latest ./
docker build --pull --network=host -f .build/frontend/Dockerfile -t docker.io/goforbroke1006/onix-dashboard-admin:latest ./frontend/dashboard-admin
image/frontend/dashboard-main:
docker build --pull --network=host -f .build/frontend/main/Dockerfile -t docker.io/goforbroke1006/onix-dashboard-main:latest ./
docker push docker.io/goforbroke1006/onix-dashboard-main:latest
image/frontend/dashboard-admin:
docker build --pull --network=host -f .build/frontend/admin/Dockerfile -t docker.io/goforbroke1006/onix-dashboard-admin:latest ./
docker push docker.io/goforbroke1006/onix-dashboard-admin:latest
.PHONY: setup
setup:
bash ./setup.sh