-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (45 loc) · 1.5 KB
/
Makefile
File metadata and controls
55 lines (45 loc) · 1.5 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
.PHONY: small-build small-validate small-lint small-test small-format small-format-check verify sync-schemas
GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
BIN_DIR := bin
BIN_NAME := small
BIN_PATH := $(BIN_DIR)/$(BIN_NAME)
# Sync schemas from spec to embedded location before building
sync-schemas:
@echo "Syncing embedded schemas..."
@mkdir -p internal/specembed/schemas
@cp spec/small/v1.0.0/schemas/*.schema.json internal/specembed/schemas/
@echo "✓ Schemas synced to internal/specembed/schemas/"
small-build: sync-schemas
@echo "Building SMALL CLI..."
@mkdir -p $(BIN_DIR)
@go build -o $(BIN_PATH) ./cmd/small
@echo "Built $(BIN_PATH)"
small-validate: small-build
@echo "Validating examples directory..."
@$(BIN_PATH) validate --dir spec/small/v1.0.0/examples
@if [ -d .small ]; then \
echo "Validating repo root .small/ artifacts..."; \
$(BIN_PATH) validate --dir .; \
fi
small-lint: small-build
@echo "Linting examples directory..."
@$(BIN_PATH) lint --dir spec/small/v1.0.0/examples
small-test:
@echo "Running Go tests..."
@go test ./...
small-format:
@echo "Formatting Go code..."
@gofmt -s -w ./cmd ./internal
@echo "✓ Go code formatted"
small-format-check:
@echo "Checking Go code formatting..."
@if [ $$(gofmt -s -l ./cmd ./internal | wc -l) -gt 0 ]; then \
echo "✗ Go code is not formatted. Run 'make small-format' to fix."; \
gofmt -s -l ./cmd ./internal; \
exit 1; \
else \
echo "✓ Go code is properly formatted"; \
fi
verify:
@bash scripts/verify.sh