-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (76 loc) · 2.39 KB
/
Makefile
File metadata and controls
86 lines (76 loc) · 2.39 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
BINARY ?= yolobox
CMD_DIR := ./cmd/yolobox
IMAGE ?= ghcr.io/finbarr/yolobox:latest
PREFIX ?= $(HOME)/.local
BINDIR ?= $(PREFIX)/bin
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -ldflags "-X main.Version=$(VERSION)"
.PHONY: build test lint image smoke-test install uninstall clean
build:
go build $(LDFLAGS) -o $(BINARY) $(CMD_DIR)
test:
go test -v ./...
lint:
go vet ./...
@which golangci-lint > /dev/null && golangci-lint run || echo "golangci-lint not installed, skipping"
image:
@docker buildx version >/dev/null 2>&1 && \
docker buildx build -t $(IMAGE) . || \
docker build -t $(IMAGE) .
SMOKE_TOOLS := node bun python3 uv gh fish fd bat rg eza
smoke-test: build
@echo "Running smoke tests..."
@failed=0; \
for tool in $(SMOKE_TOOLS); do \
if ./$(BINARY) run --scratch $$tool --version >/dev/null 2>&1; then \
echo " ✓ $$tool"; \
else \
echo " ✗ $$tool"; \
failed=1; \
fi; \
done; \
if ./$(BINARY) run --scratch go version >/dev/null 2>&1; then \
echo " ✓ go"; \
else \
echo " ✗ go"; \
failed=1; \
fi; \
if ./$(BINARY) run --scratch claude --version >/dev/null 2>&1; then \
echo " ✓ claude"; \
else \
echo " ✗ claude"; \
failed=1; \
fi; \
if ./$(BINARY) run --scratch codex --version >/dev/null 2>&1; then \
echo " ✓ codex"; \
else \
echo " ✗ codex"; \
failed=1; \
fi; \
IMG_VER=$$(./$(BINARY) run --scratch /usr/local/bin/claude --version 2>/dev/null | head -1); \
RUN_VER=$$(./$(BINARY) run claude --version 2>/dev/null | head -1); \
if [ "$$IMG_VER" = "$$RUN_VER" ]; then \
echo " ✓ claude version pinned ($$RUN_VER)"; \
else \
echo " ✗ claude version mismatch: image=$$IMG_VER, got=$$RUN_VER"; \
failed=1; \
fi; \
IMG_VER=$$(./$(BINARY) run --scratch env NO_YOLO=1 codex --version 2>/dev/null | head -1); \
RUN_VER=$$(./$(BINARY) run --scratch codex --version 2>/dev/null | head -1); \
if [ "$$IMG_VER" = "$$RUN_VER" ]; then \
echo " ✓ codex wrapper matches real binary ($$RUN_VER)"; \
else \
echo " ✗ codex version mismatch: real=$$IMG_VER, wrapper=$$RUN_VER"; \
failed=1; \
fi; \
[ $$failed -eq 0 ]
@echo "Smoke tests passed!"
install: build
mkdir -p $(BINDIR)
install -m 0755 $(BINARY) $(BINDIR)/$(BINARY)
@echo "Installed $(BINARY) to $(BINDIR)/$(BINARY)"
uninstall:
rm -f $(BINDIR)/$(BINARY)
@echo "Removed $(BINDIR)/$(BINARY)"
clean:
rm -f $(BINARY)