-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (54 loc) · 2.04 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
74
75
76
include ../includes.mk
# the filepath to this repository, relative to $GOPATH/src
repo_path = github.com/deis/deis/logger
GO_FILES = $(wildcard *.go)
GO_PACKAGES = configurer drain publisher storage syslogish tests weblog
GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,$(GO_PACKAGES))
GO_TESTABLE_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,drain drain/simple storage storage/file storage/ringbuffer)
COMPONENT = $(notdir $(repo_path))
IMAGE = $(IMAGE_PREFIX)$(COMPONENT):$(BUILD_TAG)
DEV_IMAGE = $(REGISTRY)$(IMAGE)
BINARY_DEST_DIR = image/bin
build: check-docker
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/logger github.com/deis/deis/logger || exit 1
@$(call check-static-binary,$(BINARY_DEST_DIR)/logger)
docker build -t $(IMAGE) image
clean: check-docker check-registry
rm -f image/bin/logger
docker rmi $(IMAGE)
full-clean: check-docker check-registry
docker images -q $(IMAGE_PREFIX)$(COMPONENT) | xargs docker rmi -f
install: check-deisctl
deisctl install $(COMPONENT)
uninstall: check-deisctl
deisctl uninstall $(COMPONENT)
start: check-deisctl
deisctl start $(COMPONENT)
stop: check-deisctl
deisctl stop $(COMPONENT)
restart: stop start
run: install start
dev-release: push set-image
push: check-registry
docker tag -f $(IMAGE) $(DEV_IMAGE)
docker push $(DEV_IMAGE)
set-image: check-deisctl
deisctl config $(COMPONENT) set image=$(DEV_IMAGE)
release:
docker push $(IMAGE)
deploy: build dev-release restart
test: test-style test-unit test-functional
test-functional:
@$(MAKE) -C ../tests/ test-etcd
GOPATH=`cd ../tests/ && godep path`:$(GOPATH) go test -v ./tests/...
test-style:
# display output, then check
$(GOFMT) $(GO_PACKAGES) $(GO_FILES)
@$(GOFMT) $(GO_PACKAGES) $(GO_FILES) | read; if [ $$? == 0 ]; then echo "gofmt check failed."; exit 1; fi
$(GOVET) $(repo_path) $(GO_PACKAGES_REPO_PATH)
$(GOLINT) ./...
test-unit: test-style
$(GOTEST) $(GO_TESTABLE_PACKAGES_REPO_PATH)
coverage:
go test -coverprofile coverage.out ./syslog
go tool cover -html=coverage.out