-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathMakefile
63 lines (47 loc) · 1.57 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
NAME := mani
PACKAGE := github.com/alajmo/$(NAME)
DATE := $(shell date +"%Y %B %d")
GIT := $(shell [ -d .git ] && git rev-parse --short HEAD)
VERSION := v0.30.0
default: build
tidy:
go get -u && go mod tidy
gofmt:
go fmt ./cmd/***.go
go fmt ./core/***.go
go fmt ./core/dao/***.go
go fmt ./core/exec/***.go
go fmt ./core/print/***.go
go fmt ./core/tui/***.go
go fmt ./test/integration/***.go
lint:
golangci-lint run ./cmd/... ./core/...
deadcode .
test:
# Unit tests
go test -v ./core/dao/***
# Integration tests
./test/scripts/test --build --count 5 --clean
test-unit:
go test -v ./core/dao/***
test-integration:
./test/scripts/test --count 5 --build --clean
update-golden-files:
./test/scripts/test --build --update
build:
CGO_ENABLED=0 go build \
-ldflags "-w -X '${PACKAGE}/cmd.version=${VERSION}' -X '${PACKAGE}/core/tui.version=${VERSION}' -X '${PACKAGE}/cmd.commit=${GIT}' -X '${PACKAGE}/cmd.date=${DATE}'" \
-a -tags netgo -o dist/${NAME} main.go
build-all:
goreleaser release --skip-publish --rm-dist --snapshot
build-test:
CGO_ENABLED=0 go build \
-ldflags "-X '${PACKAGE}/core/dao.build_mode=TEST'" \
-a -tags netgo -o dist/${NAME} main.go
gen-man:
go run -ldflags="-X 'github.com/alajmo/mani/cmd.buildMode=man' -X '${PACKAGE}/cmd.version=${VERSION}' -X '${PACKAGE}/cmd.commit=${GIT}' -X '${PACKAGE}/cmd.date=${DATE}'" ./main.go gen-docs
release:
git tag ${VERSION} && git push origin ${VERSION}
clean:
$(RM) -r dist target
.PHONY: tidy gofmt lint test test-unit test-integration update-golden-files build build-all build-test gen-man release clean