-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
73 lines (52 loc) · 1.78 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
68
69
70
71
72
73
GOPACKAGES = $(shell go list ./... | grep -v /vendor/)
APP=geo2tz
.PHONY: list
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
default: build
workdir:
mkdir -p dist
build: build-dist
build-dist: $(GOFILES)
@echo build binary
goreleaser build --single-target --config .github/.goreleaser.yaml --snapshot --clean
@echo done
_check_version:
ifndef APP_VERSION
$(error APP_VERSION is not set, please specifiy the version you want to tag)
endif
test: test-all
test-all:
@go test -v $(GOPACKAGES) -race -covermode=atomic -coverprofile coverage.txt
test-coverage:
go test -mod=readonly -coverprofile=coverage.out -covermode=atomic -timeout 30s $(GOPACKAGES) && \
go tool cover -html=coverage.out
test-ci:
go run main.go update current
go test -coverprofile=coverage.txt -covermode=atomic -race -mod=readonly $(GOPACKAGES)
bench: bench-all
bench-all:
@go test -bench -v $(GOPACKAGES)
go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify
lint:
@echo "--> Running linter"
golangci-lint run --config .github/.golangci.yaml
@go mod verify
debug-start:
@go run main.go start
k8s-deploy: _check_version
@echo deploy k8s
kubectl -n $(K8S_NAMESPACE) set image deployment/$(K8S_DEPLOYMENT) $(DOCKER_IMAGE)=$(DOCKER_REGISTRY)/$(DOCKER_IMAGE):$(APP_VERSION)
@echo done
k8s-rollback:
@echo deploy k8s
kubectl -n $(K8S_NAMESPACE) rollout undo deployment/$(K8S_DEPLOYMENT)
@echo done
update-tzdata:
@echo "--> Updating timzaone data"
@echo build binary
goreleaser build --single-target --config .github/.goreleaser.yaml --snapshot --clean -o geo2tz
./geo2tz update latest
@echo done