-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (73 loc) · 2.34 KB
/
Makefile
File metadata and controls
87 lines (73 loc) · 2.34 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
86
87
.PHONY: build test clean install lint fmt vet help
APP_NAME := github-issue-tool
BUILD_DIR := bin
MAIN_PATH := ./cmd/github-issue-tool
# Default target
all: build
# Build the application
build:
@echo "Building $(APP_NAME)..."
@go build -o $(BUILD_DIR)/$(APP_NAME) $(MAIN_PATH)
# Build for multiple platforms
build-all:
@echo "Building for multiple platforms..."
@mkdir -p $(BUILD_DIR)
@GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/$(APP_NAME)-linux-amd64 $(MAIN_PATH)
@GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/$(APP_NAME)-darwin-amd64 $(MAIN_PATH)
@GOOS=darwin GOARCH=arm64 go build -o $(BUILD_DIR)/$(APP_NAME)-darwin-arm64 $(MAIN_PATH)
@GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/$(APP_NAME)-windows-amd64.exe $(MAIN_PATH)
# Run tests
test:
@echo "Running tests..."
@go test -v ./...
# Run tests with coverage
test-coverage:
@echo "Running tests with coverage..."
@go test -v -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Format code
fmt:
@echo "Formatting code..."
@go fmt ./...
# Vet code
vet:
@echo "Vetting code..."
@go vet ./...
# Lint code (requires golangci-lint)
lint:
@echo "Linting code..."
@golangci-lint run
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -rf $(BUILD_DIR)
@rm -f coverage.out coverage.html
# Install dependencies
deps:
@echo "Installing dependencies..."
@go mod tidy
@go mod download
# Install the application locally
install: build
@echo "Installing $(APP_NAME)..."
@cp $(BUILD_DIR)/$(APP_NAME) $(GOPATH)/bin/
# Run example with dry-run
demo:
@echo "Running demo with sample issues..."
@go run $(MAIN_PATH) --file examples/sample_issues.txt --dry-run
# Help target
help:
@echo "Available targets:"
@echo " build - Build the application"
@echo " build-all - Build for multiple platforms"
@echo " test - Run tests"
@echo " test-coverage - Run tests with coverage report"
@echo " fmt - Format code"
@echo " vet - Vet code"
@echo " lint - Lint code (requires golangci-lint)"
@echo " clean - Clean build artifacts"
@echo " deps - Install dependencies"
@echo " install - Install application locally"
@echo " demo - Run demo with sample issues"
@echo " help - Show this help message"