-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
40 lines (33 loc) · 948 Bytes
/
Makefile
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
.PHONY: test
FILE = VERSION
VERSION := $(shell git describe --abbrev=0 --tags 2>/dev/null)
DATE := $(shell git log -1 --format=%ct $(VERSION) 2>/dev/null)
# Cover non-git case (compiling from release source package)
# The date will be set to the time of compilation, the tag will be consistent
ifeq ($(VERSION),)
VERSION := $(shell cat $(FILE))
DATE := $(shell date +%s)
endif
build:
@go build \
-buildmode=pie \
-ldflags="-X 'main.version=$(VERSION)' -X 'main.date=$(DATE)'" \
-o $(shell go env GOPATH)/bin/fzn ./cmd/term
@echo "Build complete"
# The following are sequential commands, but I'm separating to reduce the chance of mistakes...
new-tag:
test $(tag)
echo "$(tag)" > $(FILE)
git add $(FILE)
git commit -m "Release: $(tag)"
git tag $(tag)
release:
git push
git push --tags
goreleaser release --rm-dist
test:
go test ./... -count=1
debug:
dlv debug ./cmd/term/main.go
test-debug:
dlv test pkg/service/*