-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathMakefile
More file actions
112 lines (93 loc) · 3.02 KB
/
Makefile
File metadata and controls
112 lines (93 loc) · 3.02 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
# Shelley Makefile
.PHONY: build build-linux-aarch64 build-linux-x86 test test-go test-e2e ui serve clean help templates demo
# Default target
all: build
# Build templates into tarballs
templates:
@for dir in templates/*/; do \
name=$$(basename "$$dir"); \
tar -czf "templates/$$name.tar.gz" -C "templates/$$name" --exclude='.DS_Store' .; \
done
# Build the UI and Go binary
build: ui templates
@echo "Building Shelley..."
go build -o bin/shelley ./cmd/shelley
# Build for Linux (auto-detect architecture)
build-linux: ui templates
@echo "Building Shelley for Linux..."
@ARCH=$$(uname -m); \
case $$ARCH in \
x86_64) GOARCH=amd64 ;; \
aarch64|arm64) GOARCH=arm64 ;; \
*) echo "Unsupported architecture: $$ARCH" && exit 1 ;; \
esac; \
GOOS=linux GOARCH=$$GOARCH go build -o bin/shelley-linux ./cmd/shelley
# Build for Linux ARM64
build-linux-aarch64: ui templates
@echo "Building Shelley for Linux ARM64..."
GOOS=linux GOARCH=arm64 go build -o bin/shelley-linux-aarch64 ./cmd/shelley
# Build for Linux x86_64
build-linux-x86: ui templates
@echo "Building Shelley for Linux x86_64..."
GOOS=linux GOARCH=amd64 go build -o bin/shelley-linux-x86 ./cmd/shelley
# Build UI
ui:
@cd ui && pnpm install --frozen-lockfile --silent && pnpm run --silent build
# Run Go tests
test-go: ui
@echo "Running Go tests..."
go test -v ./...
# Run end-to-end tests
test-e2e: ui
@echo "Running E2E tests..."
cd ui && pnpm run test:e2e
# Run E2E tests in headed mode (with visible browser)
test-e2e-headed: ui
@echo "Running E2E tests (headed)..."
cd ui && pnpm run test:e2e:headed
# Run E2E tests in UI mode
test-e2e-ui: ui
@echo "Opening E2E test UI..."
cd ui && pnpm run test:e2e:ui
# Run all tests
test: test-go test-e2e
# Serve Shelley with predictable model for testing
serve-test: ui
@echo "Starting Shelley with predictable model..."
go run ./cmd/shelley --model predictable --db test.db serve
# Serve Shelley normally
serve: ui
@echo "Starting Shelley..."
go run ./cmd/shelley serve
# Clean build artifacts
clean:
@echo "Cleaning..."
rm -rf bin/
rm -rf ui/dist/
rm -rf ui/node_modules/
rm -rf ui/test-results/
rm -rf ui/playwright-report/
rm -f *.db
rm -f templates/*.tar.gz
# Build and (re)start the demo server
demo:
@./demo.py
# Show help
help:
@echo "Shelley Build Commands:"
@echo ""
@echo " build Build UI, templates, and Go binary"
@echo " build-linux-aarch64 Build for Linux ARM64"
@echo " build-linux-x86 Build for Linux x86_64"
@echo " ui Build UI only"
@echo " templates Build template tarballs"
@echo " test Run all tests (Go + E2E)"
@echo " test-go Run Go tests only"
@echo " test-e2e Run E2E tests (headless)"
@echo " test-e2e-headed Run E2E tests (visible browser)"
@echo " test-e2e-ui Open E2E test UI"
@echo " serve Start Shelley server"
@echo " serve-test Start Shelley with predictable model"
@echo " clean Clean build artifacts"
@echo " demo Build and (re)start the demo server"
@echo " help Show this help"