-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (77 loc) · 2.48 KB
/
Makefile
File metadata and controls
98 lines (77 loc) · 2.48 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
87
88
89
90
91
92
93
94
95
96
97
98
.PHONY: build test lint clean install run help generate-db update-db db-stats release release-snapshot release-check
# Binary name
BINARY=cryptodeps
# Build variables
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS := -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)"
# Default target
all: build
## build: Build the binary
build:
go build $(LDFLAGS) -o $(BINARY) ./cmd/cryptodeps
## install: Install the binary to $GOPATH/bin
install:
go install $(LDFLAGS) ./cmd/cryptodeps
## test: Run tests
test:
go test -v -race -coverprofile=coverage.out ./...
## test-short: Run tests without race detector
test-short:
go test -v -coverprofile=coverage.out ./...
## coverage: Show test coverage
coverage: test
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
## lint: Run linter
lint:
golangci-lint run ./...
## fmt: Format code
fmt:
go fmt ./...
gofumpt -l -w .
## clean: Remove build artifacts
clean:
rm -f $(BINARY)
rm -f coverage.out coverage.html
rm -rf dist/
## run: Build and run with sample input
run: build
./$(BINARY) version
## deps: Download dependencies
deps:
go mod download
go mod tidy
## generate-db: Generate data/crypto-database.json for GitHub releases
generate-db:
@echo "Generating crypto-database.json..."
@go run cmd/gendb/main.go 2>/dev/null > data/crypto-database.json
@echo "Done. Database saved to data/crypto-database.json"
@echo "Packages: $$(jq '.packages | length' data/crypto-database.json)"
## update-db: Update local database cache from GitHub releases
update-db:
./$(BINARY) update || go run ./cmd/cryptodeps update
## db-stats: Show database statistics
db-stats:
./$(BINARY) status || go run ./cmd/cryptodeps status
## release-check: Validate goreleaser configuration
release-check:
goreleaser check
## release-snapshot: Build a snapshot release (no publish)
release-snapshot:
goreleaser release --snapshot --clean
## release: Build and publish a release (requires GITHUB_TOKEN)
release:
goreleaser release --clean
## docker-build: Build Docker image locally
docker-build: build
docker build -t cryptodeps:local -f Dockerfile.goreleaser .
## help: Show this help
help:
@echo "CryptoDeps - Dependency Crypto Analyzer"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@grep -E '^## ' Makefile | sed 's/## / /'