-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (49 loc) · 2.35 KB
/
Makefile
File metadata and controls
63 lines (49 loc) · 2.35 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
BINARY := forge
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT)
COVERFILE := coverage.out
MODULES := forge-core forge-cli forge-plugins forge-ui
.PHONY: build test test-integration vet fmt lint cover cover-html install clean release fetch-monaco help
## build: Compile the forge binary
build:
cd forge-cli && go build -ldflags "$(LDFLAGS)" -o ../$(BINARY) ./cmd/forge
## test: Run all unit tests with race detection across all modules
test:
@for mod in $(MODULES); do echo "==> Testing $$mod"; (cd $$mod && go test -race ./...); done
## test-integration: Run integration tests (requires build tag)
test-integration:
@for mod in $(MODULES); do echo "==> Integration testing $$mod"; (cd $$mod && go test -race -tags=integration ./...); done
## vet: Run go vet on all modules
vet:
@for mod in $(MODULES); do echo "==> Vetting $$mod"; (cd $$mod && go vet ./...); done
## fmt: Check that all Go files are gofmt-compliant
fmt:
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:"; gofmt -l .; exit 1)
## lint: Run golangci-lint on all modules (must be installed separately)
lint:
@for mod in $(MODULES); do echo "==> Linting $$mod"; (cd $$mod && golangci-lint run ./...); done
## cover: Generate test coverage report for all modules
cover:
@for mod in $(MODULES); do echo "==> Coverage $$mod"; (cd $$mod && go test -race -coverprofile=$(COVERFILE) ./... && go tool cover -func=$(COVERFILE)); done
## cover-html: Open coverage report in browser (forge-cli)
cover-html:
cd forge-cli && go test -race -coverprofile=$(COVERFILE) ./... && go tool cover -html=$(COVERFILE)
## install: Install forge to GOPATH/bin
install:
cd forge-cli && go install -ldflags "$(LDFLAGS)" ./cmd/forge
## clean: Remove build artifacts and coverage files
clean:
rm -f $(BINARY)
@for mod in $(MODULES); do rm -f $$mod/$(COVERFILE); done
## release: Build a snapshot release using goreleaser
release:
goreleaser release --snapshot --clean
## fetch-monaco: Build tree-shaken YAML-only Monaco editor (~615KB)
fetch-monaco:
@bash forge-ui/static/dist/monaco/build.sh forge-ui/static/dist/monaco
## help: Show this help message
help:
@echo "Usage: make [target]"
@echo ""
@sed -n 's/^## //p' $(MAKEFILE_LIST) | column -t -s ':'