-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (61 loc) · 1.61 KB
/
Makefile
File metadata and controls
74 lines (61 loc) · 1.61 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: build test install clean fmt lint help
# Binary name
BINARY_NAME=go-semver-audit
BUILD_DIR=bin
# Go commands
GOCMD=go
GOBUILD=$(GOCMD) build
GOTEST=$(GOCMD) test
GOINSTALL=$(GOCMD) install
GOCLEAN=$(GOCMD) clean
GOFMT=$(GOCMD) fmt
GOVET=$(GOCMD) vet
# Build the project
build:
@echo "Building $(BINARY_NAME)..."
@mkdir -p $(BUILD_DIR)
$(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/go-semver-audit
# Run tests
test:
@echo "Running tests..."
$(GOTEST) -v ./...
# Run tests with coverage
test-coverage:
@echo "Running tests with coverage..."
$(GOTEST) -cover -coverprofile=coverage.out ./...
$(GOCMD) tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Install the binary
install:
@echo "Installing $(BINARY_NAME)..."
$(GOINSTALL) ./cmd/go-semver-audit
# Clean build artifacts
clean:
@echo "Cleaning..."
$(GOCLEAN)
rm -rf $(BUILD_DIR)
rm -f coverage.out coverage.html
# Format code
fmt:
@echo "Formatting code..."
$(GOFMT) ./...
# Run linter
lint:
@echo "Running go vet..."
$(GOVET) ./...
# Run all checks (format, lint, test)
check: fmt lint test
# Show help
help:
@echo "Available targets:"
@echo " build - Build the binary"
@echo " test - Run tests"
@echo " test-coverage - Run tests with coverage report"
@echo " install - Install the binary"
@echo " clean - Clean build artifacts"
@echo " fmt - Format code"
@echo " lint - Run linter"
@echo " check - Run format, lint, and tests"
@echo " help - Show this help message"
# Default target
.DEFAULT_GOAL := build