-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (39 loc) · 1.23 KB
/
Makefile
File metadata and controls
51 lines (39 loc) · 1.23 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
VERSION := $(shell git describe --tags --match "v[0-9]*" --abbrev=7 --always --dirty 2>/dev/null | sed 's/^$$/v0.0.0-dev/')
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
BUILT_AT := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -ldflags "\
-X main.Version=$(VERSION) \
-X main.Commit=$(COMMIT) \
-X main.BuiltAt=$(BUILT_AT)"
BINARY := bin/fusemomo
PACKAGE := github.com/fusemomo/fusemomo-cli
.PHONY: build test test-unit lint install clean release
## build: Compile the fusemomo binary with version/commit/date injection
build:
@mkdir -p bin
go build $(LDFLAGS) -o $(BINARY) .
@echo "Built $(BINARY) $(VERSION) ($(COMMIT))"
## test: Run all tests with race detector
test:
go test -race ./...
## test-unit: Run unit tests only
test-unit:
go test -race ./test/... -v
## lint: Run golangci-lint
lint:
golangci-lint run ./...
## install: Install the binary to $GOPATH/bin
install:
go install $(LDFLAGS) .
## clean: Remove the bin/ directory
clean:
rm -rf bin/
## release: Build cross-platform releases with GoReleaser
release:
goreleaser release --clean
## run: Run directly with go run
run:
go run $(LDFLAGS) . $(ARGS)
## help: Show this help
help:
@grep -E '^## ' Makefile | sed 's/## / /'