-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (59 loc) · 1.56 KB
/
Makefile
File metadata and controls
75 lines (59 loc) · 1.56 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
.PHONY: help test cover lint build clean
OUTPUT_DIR ?= bin
VERSION ?= $(shell jq -r '."."' .github/.release-manifest.json 2>/dev/null || echo "dev")
# Default target
.DEFAULT_GOAL := help
## help: Display this help message
help:
@echo "Available targets:"
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/^## / /'
## test: Run all tests
test:
go test -v -race ./...
## cover: Run tests with coverage
cover:
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -func=coverage.out
## cover-html: Generate HTML coverage report
cover-html: cover
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
## lint: Run linter
lint:
golangci-lint run ./...
## fmt: Format code
fmt:
go fmt ./...
gofumpt -l -w .
## vet: Run go vet
vet:
go vet ./...
## build: Build the binary
build:
@mkdir -p $(OUTPUT_DIR)
@CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=$(VERSION)" -o $(OUTPUT_DIR)/openapi-generator ./cmd/openapi-generator
## install: Install the binary
install:
go install ./cmd/openapi-generator
## clean: Clean build artifacts
clean:
rm -rf $(OUTPUT_DIR)
rm -f coverage.out coverage.html
rm -rf artifacts/
rm -rf generated/
## tidy: Tidy go modules
tidy:
go mod tidy
## update: Update dependencies
update:
go get -u ./...
go mod tidy
## generate: Run code generation (example usage)
generate:
@echo "Generating code from sample spec..."
./openapi-generator generate \
-i samples/config.yaml \
-g typescript-fetch \
-o generated
## all: Run tests, lint, and build
all: test lint build