-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
78 lines (60 loc) · 1.83 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
.PHONY: build lint deps dev_deps generate portal clean work dev
BUILDER := "unknown"
VERSION := "unknown"
ifeq ($(origin API_BUILDER),undefined)
BUILDER = $(shell git config --get user.name);
else
BUILDER = ${API_BUILDER};
endif
ifeq ($(origin API_VERSION),undefined)
VERSION = $(shell git rev-parse HEAD);
else
VERSION = ${API_VERSION};
endif
build:
GOOS=linux GOARCH=amd64 go build -v -ldflags "-X 'main.Version=${VERSION}' -X 'main.Unix=$(shell date +%s)' -X 'main.User=${BUILDER}'" -o out/api cmd/*.go
lint:
# golangci-lint run --go=1.18
# yarn prettier --check .
format:
gofmt -s -w .
# yarn prettier --write .
deps:
go install github.com/swaggo/swag/cmd/swag@v1.8.10
go install github.com/99designs/gqlgen@v0.17.24
go mod download
dev_deps:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.0
yarn
generate:
echo ${DOCROOT}
swag init --dir internal/api/rest/v3,data -g v3.go -o internal/api/rest/v3/docs & swag init --dir internal/api/rest/v2 -g v2.go -o internal/api/rest/v2/docs
gqlgen --config ./gqlgen.v3.yml
make format
portal:
yarn --cwd ./portal
yarn --cwd ./portal build
portal_stage:
yarn --cwd ./portal
yarn --cwd ./portal build --mode=stage
test:
go test -count=1 -cover -parallel $$(nproc) -race ./...
clean:
rm -rf \
out \
internal/api/gql/v2/gen/generated/generated-gqlgen.go \
internal/api/gql/v2/gen/model/models-gqlgen.go \
internal/api/gql/v3/gen/generated/generated-gqlgen.go \
internal/api/gql/v3/gen/model/models-gqlgen.go \
internal/api/rest/v2/docs \
internal/api/rest/v3/docs \
node_modules
work:
echo -e "go 1.18\n\nuse (\n\t.\n\t../Common\n\t../message-queue/go\n\t../image-processor/go\n\t../CompactDisc\n)" > go.work
go mod tidy
dev:
go run cmd/main.go
terraform:
terraform -chdir=./terraform init
deploy:
terraform -chdir=./terraform apply -auto-approve