-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (56 loc) · 1.62 KB
/
Makefile
File metadata and controls
72 lines (56 loc) · 1.62 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
.PHONY: build run test test-cover lint clean docker-build docker-run help
BINARY_NAME=auth-webhook
DOCKER_IMAGE=auth-webhook
DOCKER_TAG=latest
build:
go build -o bin/$(BINARY_NAME) ./cmd/webhook
run:
go run ./cmd/webhook
test:
go test -v ./...
test-cover:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
test-race:
go test -race ./...
lint:
golangci-lint run
fmt:
go fmt ./...
vet:
go vet ./...
tidy:
go mod tidy
clean:
rm -rf bin/
rm -f coverage.out coverage.html
docker-build:
docker build -t $(DOCKER_IMAGE):$(DOCKER_TAG) .
docker-run:
docker run --rm -p 8080:8080 -p 9090:9090 \
-e WEBHOOK_SECRET=your-secret \
-e DATABASE_URL=postgres://localhost/db \
$(DOCKER_IMAGE):$(DOCKER_TAG)
docker-push:
docker push $(DOCKER_IMAGE):$(DOCKER_TAG)
dev:
@echo "Starting development server..."
@export WEBHOOK_SECRET=dev-secret && \
export DATABASE_URL=postgres://localhost:5432/auth_webhook?sslmode=disable && \
go run ./cmd/webhook
help:
@echo "Available targets:"
@echo " build - Build the binary"
@echo " run - Run the application"
@echo " test - Run tests"
@echo " test-cover - Run tests with coverage"
@echo " test-race - Run tests with race detector"
@echo " lint - Run linter"
@echo " fmt - Format code"
@echo " vet - Run go vet"
@echo " tidy - Tidy go modules"
@echo " clean - Clean build artifacts"
@echo " docker-build - Build Docker image"
@echo " docker-run - Run Docker container"
@echo " docker-push - Push Docker image"
@echo " dev - Run development server"