forked from deviceinsight/kafkactl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (54 loc) · 1.63 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
64
65
66
67
BUILD_TS := $(shell date -Iseconds --utc)
COMMIT_SHA := $(shell git rev-parse HEAD)
VERSION := $(shell git describe --abbrev=0 --tags)
export CGO_ENABLED=0
export GOOS=linux
export GO111MODULE=on
project=github.com/deviceinsight/kafkactl
ld_flags := "-X $(project)/cmd.Version=$(VERSION) -X $(project)/cmd.GitCommit=$(COMMIT_SHA) -X $(project)/cmd.BuildTime=$(BUILD_TS)"
FILES := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -not -name '*_test.go')
TESTS := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -name '*_test.go')
.DEFAULT_GOAL := all
.PHONY: all
all: vet fmt lint test build docs
.PHONY: vet
vet:
go vet ./...
fmt:
gofmt -s -l -w $(FILES) $(TESTS)
lint:
golangci-lint run
.PHONY: test
test:
rm -f test.log
go test -v -short ./...
.PHONY: integration_test
integration_test:
rm -f integration-test.log
./docker/run-integration-tests.sh
.PHONY: build
build:
go build -ldflags $(ld_flags) -o kafkactl
.PHONY: docs
docs: build
touch /tmp/empty.yaml
./kafkactl docs --directory docs --single-page --config-file=/tmp/empty.yaml
.PHONY: clean
clean:
rm -f kafkactl
go clean -testcache
# usage make version=0.0.4 release
#
# manually executing goreleaser:
# export GITHUB_TOKEN=xyz
# snapcraft login
# goreleaser --rm-dist (--skip-validate)
#
.PHONY: release
release:
current_date=`date "+%Y-%m-%d"`; eval "sed -i 's/## \[Unreleased\].*/## [Unreleased]\n\n## $$version - $$current_date/g' CHANGELOG.md"
git add "CHANGELOG.md"
git commit -m "releases $(version)"
git tag -a v$(version) -m "release v$(version)"
git push origin
git push origin v$(version)