forked from litmuschaos/litmus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (86 loc) · 2.72 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Makefile for building Litmus and its tools
# Reference Guide - https://www.gnu.org/software/make/manual/make.html
#
# Internal variables or constants.
# NOTE - These will be executed when any make target is invoked.
#
IS_DOCKER_INSTALLED = $(shell which docker >> /dev/null 2>&1; echo $$?)
# list only our namespaced directories
PACKAGES = $(shell go list ./... | grep -v '/vendor/')
.PHONY: all
all: format metalint compile
.PHONY: help
help:
@echo ""
@echo "Usage:-"
@echo "\tmake deps -- will verify build dependencies are installed"
@echo "\tmake all -- [default] builds the litmus containers"
@echo ""
# `make deps` needs to be run in a completely new environment
# In case of go related issues, run below commands & verify:
# go version # ensure go1.9.1 or above
# go env # ensure if GOPATH is set
# echo $PATH # ensure if $GOPATH/bin is set
.PHONY: godeps
godeps:
@echo ""
@echo "INFO:\tverifying dependencies for Litmus ..."
@go get -u -v github.com/golang/lint/golint
@go get -u -v golang.org/x/tools/cmd/goimports
@go get -u -v github.com/golang/dep/cmd/dep
@go get -u -v github.com/DATA-DOG/godog/cmd/godog
@go get -u -v github.com/alecthomas/gometalinter
@gometalinter --install
_build_check_docker:
@if [ $(IS_DOCKER_INSTALLED) -eq 1 ]; \
then echo "" \
&& echo "ERROR:\tdocker is not installed. Please install it before build." \
&& echo "" \
&& exit 1; \
fi;
.PHONY: deps
deps: _build_check_docker godeps
.PHONY: format
format:
@echo "------------------"
@echo "--> Running go fmt"
@echo "------------------"
@go fmt $(PACKAGES)
.PHONY: lint
lint:
@echo "------------------"
@echo "--> Running golint"
@echo "------------------"
@golint $(PACKAGES)
@echo "------------------"
@echo "--> Running go vet"
@echo "------------------"
@go vet $(PACKAGES)
.PHONY: metalint
metalint:
@echo "------------------"
@echo "--> Running metalinter"
@echo "------------------"
@gometalinter $(PACKAGES) --exclude=gosec
.PHONY: compile
compile:
@echo "------------------"
@echo "--> Check compilation"
@echo "------------------"
@go test $(PACKAGES)
.PHONY: all-tools
all-tools: godog-runner-image ansible-runner-image
.PHONY: godog-runner-image
godog-runner-image:
@echo "------------------"
@echo "--> Build godog-runner image"
@echo "------------------"
sudo docker build . -f tools/godog-runner/Dockerfile -t openebs/godog-runner:ci
REPONAME="openebs" IMGNAME="godog-runner" IMGTAG="ci" ./hack/push
.PHONY: ansible-runner-image
ansible-runner-image:
@echo "------------------"
@echo "--> Build ansible-runner image"
@echo "------------------"
sudo docker build . -f tools/ansible-runner/Dockerfile -t openebs/ansible-runner:ci
REPONAME="openebs" IMGNAME="ansible-runner" IMGTAG="ci" ./hack/push