-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathMakefile
91 lines (77 loc) · 2.2 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
SHELL := /bin/bash
GITCOMMIT := $(shell git rev-parse HEAD)
VERSION := "$(shell git describe --tags --abbrev=0)-$(shell git rev-parse --short HEAD)"
all: quick-vet
linter-install:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.0
oapi-codegen-install:
go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.10.1
protoc-install:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
dev-setup: linter-install oapi-codegen-install protoc-install
oapi-codegen:
oapi-codegen -package insightapi -generate types ./api/insights-v1.yml > ./gen/insightapi/insights.types.go
oapi-codegen -package insightapi -generate client ./api/insights-v1.yml > ./gen/insightapi/insights.client.go
protoc-codegen:
protoc -I ./api \
--go_out=./gen/filterinput \
--go_opt=paths=source_relative \
./api/filter_input_spec.proto
protoc -I ./api \
--go_out=./gen/filtersuite \
--go_opt=paths=source_relative \
./api/filter_suite_spec.proto
protoc -I ./api \
--go_out=./gen/exceptionsapi \
--go_opt=paths=source_relative \
./api/exceptions_spec.proto
protoc -I ./api \
--go_out=./gen/models \
--go_opt=paths=source_relative \
./api/models.proto
protoc -I ./api \
--go_out=./gen/models \
--go_opt=paths=source_relative \
./api/insights_models.proto
protoc -I ./api \
--go_out=./gen/jsonreport \
--go_opt=paths=source_relative \
./api/json_report_spec.proto
protoc -I ./api \
--go_out=./gen/violations \
--go_opt=paths=source_relative \
./api/violations.proto
protoc -I ./api \
--go_out=./gen/checks \
--go_opt=paths=source_relative \
./api/checks.proto
setup:
mkdir -p out \
gen/insightapi \
gen/cpv1trials \
gen/cpv1 \
gen/syncv1 \
gen/filterinput \
gen/filtersuite \
gen/exceptionsapi \
gen/models \
gen/jsonreport \
gen/violations \
gen/checks
GO_CFLAGS=-X main.commit=$(GITCOMMIT) -X main.version=$(VERSION)
GO_LDFLAGS=-ldflags "-w $(GO_CFLAGS)"
quick-vet:
go build ${GO_LDFLAGS}
vet: oapi-codegen protoc-codegen
go build ${GO_LDFLAGS}
.PHONY: test
test:
go test ./...
.PHONY: clean
clean:
-rm -rf out
-rm -rf gen
gosec:
-docker run --rm -it -w /app/ -v `pwd`:/app/ securego/gosec \
-exclude-dir=/app/gen -exclude-dir=/app/spec \
/app/...