-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (45 loc) · 1.75 KB
/
Makefile
File metadata and controls
57 lines (45 loc) · 1.75 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
.PHONY: test-unit test-integration test-e2e test-destructive test-smoke test-smoke-prebuilt test-coverage test-all
BINARY_NAME=openboot
BINARY_PATH=./$(BINARY_NAME)
VERSION ?= dev
LDFLAGS=-X github.com/openbootdotdev/openboot/internal/cli.version=$(VERSION)
COVERAGE_FILE=coverage.out
COVERAGE_HTML=coverage.html
test-unit:
go test -v -timeout 5m ./...
test-integration:
go test -v -timeout 5m -tags=integration ./...
test-e2e: build
go test -v -tags=e2e -short ./...
test-destructive: build
go test -v -timeout 15m -tags="e2e,destructive" ./...
test-smoke: build
go test -v -timeout 20m -tags="e2e,destructive,smoke" -run TestSmoke ./...
# test-smoke-prebuilt: like test-smoke but skips build (uses pre-built binary in PATH or ./openboot)
test-smoke-prebuilt:
go test -v -timeout 20m -tags="e2e,destructive,smoke" -run TestSmoke ./...
test-coverage:
go test -v -timeout 5m -coverprofile=$(COVERAGE_FILE) ./...
go tool cover -html=$(COVERAGE_FILE) -o $(COVERAGE_HTML)
@echo "Coverage report generated: $(COVERAGE_HTML)"
test-all:
@echo "Running all tests..."
$(MAKE) test-unit
$(MAKE) test-integration
-$(MAKE) test-e2e
$(MAKE) test-coverage
build:
go build -ldflags="$(LDFLAGS)" -o $(BINARY_PATH) ./cmd/openboot
build-release:
@echo "Building optimized release binary (version=$(VERSION))..."
go build -ldflags="-s -w $(LDFLAGS)" -trimpath -o $(BINARY_PATH) ./cmd/openboot
@echo "Original size: $$(du -h $(BINARY_PATH) | cut -f1)"
@if command -v upx >/dev/null 2>&1; then \
echo "Compressing with UPX..."; \
upx --best --lzma --force-macos $(BINARY_PATH); \
echo "Compressed size: $$(du -h $(BINARY_PATH) | cut -f1)"; \
else \
echo "UPX not found. Install with: brew install upx"; \
fi
clean:
rm -f $(BINARY_PATH) $(COVERAGE_FILE) $(COVERAGE_HTML)