-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (66 loc) · 1.87 KB
/
Copy pathMakefile
File metadata and controls
85 lines (66 loc) · 1.87 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
73
74
75
76
77
78
79
80
81
82
83
84
85
MAIN_PATH = "cmd/pgxcli/main.go"
BUILD_PATH = "bin"
TIMEOUT = 60
.PHONY: build clean run update runc lint test precommit fmt vet test-race test-short test-verbose test-bench test-integration coverage go-mod-tidy
build:
@mkdir -p $(BUILD_PATH)
@CGO_ENABLED=0 go build -o $(BUILD_PATH)/app $(MAIN_PATH)
@echo "✓ Build complete: $(BUILD_PATH)/app"
fmt:
@echo "Formatting code..."
@gofmt -w ./cmd ./internal
@echo "✓ Code formatted"
vet:
@echo "Running go vet..."
@go vet ./...
@echo "✓ Vet passed"
lint:
@echo "Running golangci-lint..."
@golangci-lint run
@echo "✓ Lint passed"
# Test targets with different configurations
test-default: ARGS=-race
test-short: ARGS=-short
test-verbose: ARGS=-v -race
test-bench: ARGS=-run=xxxxxMatchNothingxxxxx -bench=.
test-integration: ARGS=-tags=integration
test-default test-short test-verbose test-bench test-integration: test
test-race: test-default
test:
@echo "Running tests $(ARGS)..."
@go test -timeout $(TIMEOUT)s $(ARGS) ./...
@echo "✓ Tests passed"
coverage:
@echo "Generating coverage report..."
@go test -race -covermode=atomic -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out -o coverage.html
@echo "✓ Coverage report: coverage.html"
@go tool cover -func=coverage.out | tail -1
go-mod-tidy:
@echo "Tidying go.mod..."
@go mod tidy -compat=1.26
@go mod verify
@echo "✓ Go modules verified"
precommit: fmt vet lint test
@echo "✓ All precommit checks passed"
runc: build
@./bin/app $(DB)
run:
@./bin/app $(DB)
clean:
@echo "Cleaning..."
@rm -rf $(BUILD_PATH) coverage.out coverage.html
@go clean -cache -testcache
@echo "✓ Clean complete"
update:
@go get -u ./...
DOCS_DIR := ./docs-site
VERSION ?= v0.1.1
docs-init:
git worktree add $(DOCS_DIR) docs
docs-status:
cd $(DOCS_DIR) && git status
docs-clean:
git worktree remove --force $(DOCS_DIR)
rm -rf $(DOCS_DIR)
git worktree prune