-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (58 loc) · 2.14 KB
/
Makefile
File metadata and controls
73 lines (58 loc) · 2.14 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
# Makefile for feature-installer
.PHONY: help build test lint fmt vet clean install deps check
# Default target
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# Build the binary
build: ## Build the binary
go build -v -o feature-installer .
# Run tests
test: ## Run all tests
go test -v -race ./...
# Run tests with coverage
test-coverage: ## Run tests with coverage report
go test -v -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Format code
fmt: ## Format Go code
go fmt ./...
gofmt -s -w .
# Run go vet
vet: ## Run go vet
go vet ./...
# Run linting (if golangci-lint is available)
lint: ## Run golangci-lint (requires golangci-lint to be installed)
@which golangci-lint > /dev/null || (echo "golangci-lint not found. Install from https://golangci-lint.run/usage/install/" && exit 1)
golangci-lint run
# Install dependencies
deps: ## Download and verify dependencies
go mod download
go mod verify
go mod tidy
# Run all checks (format, vet, test)
check: fmt vet test ## Run formatting, vetting, and tests
# Clean build artifacts
clean: ## Clean build artifacts
rm -f feature-installer
rm -f coverage.out coverage.html
go clean -cache
go clean -testcache
# Install the binary
install: ## Install the binary to $GOPATH/bin
go install .
# Run the CI checks locally
ci-local: deps fmt vet test ## Run the same checks as CI
# Build for multiple platforms
build-all: ## Build for multiple platforms
GOOS=linux GOARCH=amd64 go build -o feature-installer-linux-amd64 .
GOOS=linux GOARCH=arm64 go build -o feature-installer-linux-arm64 .
GOOS=darwin GOARCH=amd64 go build -o feature-installer-darwin-amd64 .
GOOS=darwin GOARCH=arm64 go build -o feature-installer-darwin-arm64 .
GOOS=windows GOARCH=amd64 go build -o feature-installer-windows-amd64.exe .
# Development target - watch for changes and run tests
dev: ## Run tests in watch mode (requires entr: brew install entr)
find . -name "*.go" | entr -c make test