-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (67 loc) · 1.65 KB
/
Makefile
File metadata and controls
83 lines (67 loc) · 1.65 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
.PHONY: help build test fmt vet clean coverage bench demo cli
# Default target
help:
@echo "Available targets:"
@echo " build - Build the CLI tool"
@echo " test - Run tests"
@echo " fmt - Format Go code"
@echo " vet - Run go vet"
@echo " clean - Clean build artifacts"
@echo " coverage - Run tests with coverage"
@echo " bench - Run benchmarks"
@echo " demo - Build WebAssembly demo"
@echo " cli - Build and install CLI tool"
@echo " check - Run all checks (fmt, vet, test)"
# Build the CLI tool
build:
go build -o xatena-cli ./cmd/xatena-cli
# Run tests
test:
go test -v ./...
# Format Go code
fmt:
go fmt ./...
# Run go vet
vet:
go vet ./...
# Clean build artifacts
clean:
rm -f xatena-cli
rm -f coverage*
rm -f demo/main.wasm
rm -f demo/wasm_exec.js
# Run tests with coverage
coverage:
go test -coverprofile=coverage.out -coverpkg=./... ./pkg/xatena ./internal/...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
@echo "Total coverage:"
@go tool cover -func=coverage.out | grep "total:"
# Run benchmarks
bench:
./bench/bench.sh
# Build WebAssembly demo
demo:
cd demo && $(MAKE) build
# Build and install CLI tool
cli: build
@echo "CLI tool built as ./xatena-cli"
# Run all checks
check: fmt vet test
@echo "All checks passed!"
# Development workflow
dev: fmt vet test
@echo "Development checks completed!"
# Install dependencies (if needed)
deps:
go mod tidy
go mod download
# Run specific test
test-pkg:
go test -v ./pkg/xatena
test-internal:
go test -v ./internal/...
# Show module information
mod-info:
go mod tidy
go list -m all