-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
145 lines (119 loc) · 3.79 KB
/
Copy pathMakefile
File metadata and controls
145 lines (119 loc) · 3.79 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
.PHONY: build build-all install clean test test-short coverage coverage-summary \
lint fmt vet deps mod-tidy mod-verify bench integration ci help
# Default target
.DEFAULT_GOAL := help
## help: Show this help message
help:
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
## build: Build the CLI binary to bin/
build:
@echo "Building gorag CLI..."
@mkdir -p bin
go build -o bin/gorag ./cmd
@echo "✓ Binary built: bin/gorag"
## build-all: Build for multiple platforms to bin/
build-all:
@echo "Building for multiple platforms..."
@mkdir -p bin
GOOS=linux GOARCH=amd64 go build -o bin/gorag-linux-amd64 ./cmd
GOOS=darwin GOARCH=amd64 go build -o bin/gorag-darwin-amd64 ./cmd
GOOS=darwin GOARCH=arm64 go build -o bin/gorag-darwin-arm64 ./cmd
GOOS=windows GOARCH=amd64 go build -o bin/gorag-windows-amd64.exe ./cmd
@echo "✓ All binaries built in bin/"
## install: Install the CLI binary to GOPATH/bin
install:
@echo "Installing gorag CLI..."
go install ./cmd
@echo "✓ Installed to $(GOPATH)/bin/gorag"
## clean: Clean build artifacts and test files
clean:
@echo "Cleaning..."
rm -rf bin/
rm -f coverage.out coverage.html
rm -rf .test/
@echo "✓ Cleaned"
## test: Run all tests
test:
@echo "Running tests..."
go test -v -timeout 120s ./...
## test-short: Run short tests without integration tests
test-short:
@echo "Running short tests..."
go test -v -short ./...
## coverage: Run tests with coverage report
coverage:
@echo "Generating coverage report..."
go test -cover ./... -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html
@echo "✓ Coverage report: coverage.html"
## coverage-summary: Show coverage summary
coverage-summary:
go test -cover ./...
## lint: Run golangci-lint
lint:
@echo "Running linter..."
golangci-lint run
## fmt: Format code with go fmt
fmt:
@echo "Formatting code..."
go fmt ./...
@echo "✓ Code formatted"
## vet: Run go vet
vet:
@echo "Running go vet..."
go vet ./...
## deps: Download module dependencies
deps:
@echo "Downloading dependencies..."
go mod download
@echo "✓ Dependencies downloaded"
## mod-tidy: Tidy go modules
mod-tidy:
@echo "Tidy modules..."
go mod tidy
@echo "✓ Modules tidied"
## mod-verify: Verify go modules
mod-verify:
@echo "Verifying modules..."
go mod verify
@echo "✓ Modules verified"
## bench: Run benchmarks
bench:
@echo "Running benchmarks..."
go test -bench=. -benchmem ./...
## integration: Run integration tests (requires Docker)
integration:
@echo "Running integration tests..."
go test -v -tags=integration ./...
## ci: Run CI checks (fmt, vet, test, coverage)
ci: fmt vet test coverage-summary
@echo "✓ CI checks passed"
## all: Run fmt, vet, lint, test
all: fmt vet lint test
@echo "✓ All checks passed"
## dev: Build and run quick test
dev: build
@echo "Running quick test..."
./bin/gorag --help
@echo "✓ Development build ready"
# =============================================================================
# MiniRAG — Mobile RAG Framework
# =============================================================================
## minirag-ios: Build MiniRAG.xcframework for iOS
minirag-ios:
@echo "Building MiniRAG.xcframework for iOS..."
gomobile bind -target=ios -o MiniRAG.xcframework ./minirag
@echo "\033[32m✓\033[0m MiniRAG.xcframework built"
## minirag-android: Build MiniRAG.aar for Android (requires NDK)
minirag-android:
@echo "Building MiniRAG.aar for Android..."
gomobile bind -target=android -androidapi 21 -o MiniRAG.aar ./minirag
@echo "\033[32m✓\033[0m MiniRAG.aar built"
## minirag-all: Build MiniRAG for iOS + Android
minirag-all: minirag-ios minirag-android
## minirag-clean: Clean MiniRAG build artifacts
minirag-clean:
rm -rf MiniRAG.xcframework MiniRAG.aar