-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (36 loc) · 1.03 KB
/
Makefile
File metadata and controls
51 lines (36 loc) · 1.03 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
.PHONY: build run test lint clean docker-build docker-up docker-down migrate proto
BINARY_NAME=taskqueue
DOCKER_IMAGE=taskqueue
build:
go build -o bin/$(BINARY_NAME) ./cmd/server
run: build
./bin/$(BINARY_NAME)
test:
go test -v -race -cover ./...
test-coverage:
go test -v -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
lint:
golangci-lint run ./...
clean:
rm -rf bin/
rm -f coverage.out coverage.html
docker-build:
docker build -t $(DOCKER_IMAGE) .
docker-up:
docker-compose up -d
docker-down:
docker-compose down
docker-logs:
docker-compose logs -f taskqueue
migrate:
psql $(DATABASE_URL) -f migrations/001_init.sql
proto:
protoc --go_out=. --go-grpc_out=. internal/api/grpc/proto/*.proto
# Development helpers
dev-db:
docker-compose up -d postgres
sleep 3
psql postgres://taskqueue:taskqueue@localhost:5432/taskqueue?sslmode=disable -f migrations/001_init.sql
dev: dev-db
go run ./cmd/server -database-url="postgres://taskqueue:taskqueue@localhost:5432/taskqueue?sslmode=disable"