-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (43 loc) · 2.3 KB
/
Copy pathMakefile
File metadata and controls
60 lines (43 loc) · 2.3 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
# openemail CLI — developer targets.
BINARY := openemail
PKG := github.com/Open-Email/cli
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
LDFLAGS := -s -w -X $(PKG)/internal/cli.Version=$(VERSION)
# Local dev core (wrangler dev) + seed keys, for the integration target.
OPENEMAIL_API_URL ?= http://localhost:8787
export OPENEMAIL_API_URL
# Sibling core checkout, source of the vendored OpenAPI snapshot.
CORE_DIR ?= ../openemail-core
.PHONY: build install test vet fmt lint tidy clean snapshot sync-spec integration live completions help
build: ## Build the binary into ./bin
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/openemail
install: ## go install the binary
go install -ldflags "$(LDFLAGS)" ./cmd/openemail
test: ## Run the fast unit tests
go test -race ./...
vet: ## go vet
go vet ./...
fmt: ## Check formatting (fails if any file is unformatted)
@test -z "$$(gofmt -l .)" || (echo "unformatted:"; gofmt -l .; exit 1)
lint: fmt vet ## fmt + vet
tidy: ## go mod tidy
go mod tidy
clean: ## Remove build artifacts
rm -rf bin completions dist
snapshot: ## Dry-run a full goreleaser build (needs goreleaser installed)
goreleaser release --snapshot --clean
sync-spec: ## Refresh the vendored openapi.snapshot.json from core ($(CORE_DIR); run `npm run spec` there first)
@test -f $(CORE_DIR)/openapi.snapshot.json || { echo "not found: $(CORE_DIR)/openapi.snapshot.json (set CORE_DIR or run 'npm run spec' in core)"; exit 1; }
cp $(CORE_DIR)/openapi.snapshot.json ./openapi.snapshot.json
@echo "vendored openapi.snapshot.json from $(CORE_DIR)"
completions: build ## Generate shell completions into ./completions
@mkdir -p completions
@for sh in bash zsh fish; do ./bin/$(BINARY) completion $$sh > completions/$(BINARY).$$sh; done
@echo "wrote completions/$(BINARY).{bash,zsh,fish}"
integration: build ## Run the integration suite against local wrangler dev (must be running + seeded)
go test -tags integration -race ./test/...
live: ## Run the live e2e suite against a DEPLOYED core (needs OE_HOST + OE_SYSTEM_KEY; see test/live/README.md)
go test -tags live -count=1 -timeout 20m ./test/live/...
help: ## List targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS=":.*?## "}; {printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}'