-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (39 loc) · 1.13 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
LINT_TARGETS=./cmd/... ./lib/... ./testing/...
.PHONY: all
all: clean certs protoc build lint test
.PHONY: protoc
protoc:
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
./lib/protobuf/api.proto
.PHONY: build
build: protoc
go fmt ./...
go mod vendor
GOOS=linux go build -race -o ./bin/server cmd/server/main.go
go build -race -o ./bin/client cmd/client/main.go
.PHONY: install-tools
install-tools:
go get -u google.golang.org/grpc
go get -u github.com/golang/protobuf/protoc-gen-go
go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc
.PHONY: install-linter
install-linter:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin v1.39.0
.PHONY: docker-build
docker-build:
docker build -t worker-api-server .
.PHONY: docker-run
docker-run:
docker run --privileged -p 8080:8080 worker-api-server:latest
.PHONY: lint
lint:
./bin/golangci-lint run $(LINT_TARGETS)
certs:
./scripts/generate-mtls-certs.sh
.PHONY: test
test: certs
go test -race -timeout 30s ./...
.PHONY: clean
clean:
rm -rf certs bin lib/protobuf/*.go