Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (63 loc) · 1.71 KB
/
Copy pathMakefile
File metadata and controls
80 lines (63 loc) · 1.71 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
.PHONY: build install clean test test-short coverage coverage-summary fmt vet lint \
mod-tidy mod-verify bench dev release
# Default target
.DEFAULT_GOAL := help
## help: Show this help message
help:
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## build: Build the CLI binary to bin/
build:
@echo "Building grag CLI..."
@mkdir -p bin
go build -o bin/grag ./cmd
@echo "Done: bin/grag"
## install: Install the CLI binary as `grag` to GOPATH/bin
install:
@mkdir -p "$(shell go env GOPATH)/bin"
go build -o "$(shell go env GOPATH)/bin/grag" ./cmd
@echo "Done: $(shell go env GOPATH)/bin/grag"
## clean: Clean build artifacts and test files
clean:
rm -rf bin/ coverage.out coverage.html
## test: Run all tests
test:
go test -v -timeout 120s ./...
## test-short: Run short tests without heavy integration
test-short:
go test -v -short ./...
## coverage: Run tests with coverage report
coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
## coverage-summary: Show coverage summary
coverage-summary:
go test -cover ./...
## fmt: Format code with go fmt
fmt:
@echo "Formatting code..."
go fmt ./...
## vet: Run go vet
vet:
go vet ./...
## lint: Run golangci-lint
lint:
golangci-lint run
## mod-tidy: Tidy go modules
mod-tidy:
go mod tidy
## mod-verify: Verify go modules
mod-verify:
go mod verify
## bench: Run benchmarks
bench:
go test -bench=. -benchmem ./...
## dev: Build and show help
dev: build
./bin/grag --help
## release: Simulate a local release with goreleaser (dry-run)
release:
goreleaser release --snapshot --clean