-
Notifications
You must be signed in to change notification settings - Fork 84
/
Makefile
51 lines (37 loc) · 1.22 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
.PHONY: default clean docs porcelain install assets lint test build publish-images test-release release
TAG_NAME := $(shell git tag -l --contains HEAD)
SHA := $(shell git rev-parse --short HEAD)
VERSION := $(if $(TAG_NAME),$(TAG_NAME),$(SHA))
BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
BUILD_TAGS := -tags=release
MODULE := github.com/volkszaehler/mbmd
LD_FLAGS := -X "${MODULE}/server.Version=${VERSION}" -X "${MODULE}/server.Commit=${SHA}"
BUILD_ARGS := -ldflags='$(LD_FLAGS)'
default: clean install lint test build
clean:
rm -rf dist/
docs:
go run $(MODULE) doc
porcelain:
gofmt -w -l $$(find . -name '*.go')
go mod tidy
test -z "$$(git status --porcelain)" || (git status; git diff; false)
install:
go install $$(go list -e -f '{{join .Imports " "}}' tools.go)
assets:
go generate ./...
lint:
golangci-lint run
test:
@echo "Running testsuite"
go test ./...
build:
@echo Version: $(VERSION) $(BUILD_DATE)
go build -v $(BUILD_TAGS) $(BUILD_ARGS)
publish-images:
@echo Version: $(VERSION) $(BUILD_DATE)
seihon publish -v "$(TAG_NAME)" -v "latest" --image-name volkszaehler/mbmd --base-runtime-image alpine --dry-run=false
test-release:
goreleaser --snapshot --skip-publish --clean
release:
goreleaser --clean