-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (62 loc) · 1.87 KB
/
Makefile
File metadata and controls
73 lines (62 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
.PHONY: help build clean test test-unit test-e2e test-coverage clean-test fmt lint check
# Default target - show help
help:
@echo "lnk - Symlink Management Tool"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " help Show this help message"
@echo " build Build the lnk binary"
@echo " clean Remove build artifacts"
@echo " test Run all tests with verbose output"
@echo " test-unit Run unit tests only"
@echo " test-e2e Run end-to-end tests only"
@echo " test-coverage Run tests with coverage report (generates HTML)"
@echo " clean-test Clean up test artifacts"
@echo " fmt Format all Go code"
@echo " lint Run go vet for static analysis"
@echo " check Run fmt, test, and lint in sequence"
# Build the lnk binary
build:
mkdir -p bin
@# Generate dev+timestamp for local builds (releases override via ldflags)
@VERSION=$$(date -u '+dev+%Y%m%d%H%M%S'); \
echo "Building lnk $$VERSION..."; \
go build -ldflags "-X 'main.version=$$VERSION'" -o bin/lnk cmd/lnk/main.go
# Clean build artifacts
clean:
rm -rf bin/
rm -f coverage.out coverage.html
# Clean test artifacts
clean-test:
rm -rf e2e/testdata/
@echo "Test data cleaned. Run 'scripts/setup-testdata.sh' to recreate."
# Run tests
test:
go test -v ./...
# Run unit tests only
test-unit:
go test -v ./internal/...
# Run E2E tests only
test-e2e:
go test -v ./e2e/...
# Run tests with coverage
test-coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
# Format code
fmt:
@if command -v goimports >/dev/null 2>&1; then \
echo "Running goimports..."; \
goimports -w .; \
else \
echo "goimports not found, using gofmt..."; \
gofmt -w .; \
fi
# Run static analysis with go vet
lint:
@echo "Running go vet..."
go vet ./...
# Run all checks
check: fmt test lint