-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (45 loc) · 1.13 KB
/
Makefile
File metadata and controls
58 lines (45 loc) · 1.13 KB
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
.PHONY: build run test clean proto deps docker
# Binary name
BINARY_NAME=hue
MAIN_PATH=./cmd/hue
# Build the application
build:
go build -o bin/$(BINARY_NAME) $(MAIN_PATH)
# Run the application
run:
go run $(MAIN_PATH)
# Run tests
test:
go test -v -race -coverprofile=coverage.out ./...
# View coverage
coverage:
go tool cover -html=coverage.out
# Clean build artifacts
clean:
rm -rf bin/
rm -f coverage.out
# Generate protobuf files
proto:
git clone https://github.com/googleapis/googleapis.git third_party/googleapis --depth 1
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
--grpc-gateway_out=. --grpc-gateway_opt=paths=source_relative \
--openapiv2_out=. --openapiv2_opt=allow_merge=true,merge_file_name=hue \
-I third_party/googleapis -I proto \
proto/*.proto
# Install dependencies
deps:
go mod download
go mod tidy
# Docker build
docker:
docker build -t hue:latest -f deployments/docker/Dockerfile .
# Docker run
docker-run:
docker-compose -f deployments/docker/docker-compose.yml up -d
# Lint
lint:
golangci-lint run ./...
# Format code
fmt:
go fmt ./...