-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (42 loc) · 1.42 KB
/
Makefile
File metadata and controls
53 lines (42 loc) · 1.42 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
.PHONY: build test lint clean install selfcheck release-local
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -s -w -X github.com/SHCDevelops/galo/internal/cli.Version=$(VERSION)
## build: Build binary
build:
go build -ldflags "$(LDFLAGS)" -o galo ./cmd/galo
## install: Install to GOPATH/bin
install:
go install -ldflags "$(LDFLAGS)" ./cmd/galo
## test: Run tests
test:
go test -v -race ./...
## test-cover: Run tests with coverage report
test-cover:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
## lint: Run linters
lint:
@which golangci-lint > /dev/null 2>&1 || (echo "Installing golangci-lint..." && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
$(shell go env GOPATH)/bin/golangci-lint run ./...
## lint-simple: Run go vet only (no external tools)
lint-simple:
go vet ./...
## selfcheck: Run galo on itself
selfcheck: build
./galo scan ./...
## clean: Remove build artifacts
clean:
rm -f galo
rm -f coverage.out coverage.html
rm -rf dist/
rm -rf .galo/
## release-local: Test release locally (dry-run)
release-local:
@which goreleaser > /dev/null || go install github.com/goreleaser/goreleaser@latest
goreleaser release --snapshot --clean
## help: Show this help
help:
@echo "Usage: make [target]"
@echo ""
@sed -n 's/^## //p' $(MAKEFILE_LIST) | column -t -s ':'