-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (26 loc) · 1.28 KB
/
Makefile
File metadata and controls
38 lines (26 loc) · 1.28 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
.PHONY: all build story-extractor ui-server test cover fmt vet lint clean help
VERSION_PKG := github.com/fxnn/news/internal/version
BUILD_TIMESTAMP := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
BUILD_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null | grep -v '^HEAD$$' || echo unknown)
LDFLAGS := -X $(VERSION_PKG).BuildTimestamp=$(BUILD_TIMESTAMP) -X $(VERSION_PKG).BuildBranch=$(BUILD_BRANCH)
all: fmt vet test build ## Format, vet, test, and build everything
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*## ' $(MAKEFILE_LIST) | awk -F ':.*## ' '{printf " %-20s %s\n", $$1, $$2}'
build: story-extractor ui-server ## Build both binaries
story-extractor: ## Build story-extractor
go build -ldflags "$(LDFLAGS)" -o story-extractor ./cmd/story-extractor
ui-server: ## Build ui-server
go build -ldflags "$(LDFLAGS)" -o ui-server ./cmd/ui-server
test: ## Run all tests
go test ./...
cover: ## Run tests with coverage report
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
fmt: ## Format all Go source files
go fmt ./...
vet: ## Run static analysis
go vet ./...
lint: ## Run golangci-lint (requires golangci-lint to be installed)
golangci-lint run --timeout=5m
clean: ## Remove binaries and coverage output
rm -f story-extractor ui-server coverage.out