forked from splunk/splunk-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
102 lines (81 loc) · 2.33 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
101
102
# text reset
NO_COLOR=\033[0m
# green
OK_COLOR=\033[32;01m
# red
ERROR_COLOR=\033[31;01m
# cyan
WARN_COLOR=\033[36;01m
# yellow
ATTN_COLOR=\033[33;01m
ROOT_DIR := $(shell git rev-parse --show-toplevel)
VERSION := `git describe --tags --dirty 2>/dev/null`
COMMITHASH := `git rev-parse --short HEAD 2>/dev/null`
DATE := `date "+%FT%T%z"`
CONTAINER_NAME := 'splunk'
.PHONY: all
all: build_app test
init:
@echo "$(ATTN_COLOR)==> init $(NO_COLOR)"
.PHONY: build_app
build_app:
@echo "$(ATTN_COLOR)==> build_app $(NO_COLOR)"
@python setup.py build dist
.PHONY: docs
docs:
@echo "$(ATTN_COLOR)==> docs $(NO_COLOR)"
@rm -rf ./docs/_build
@tox -e docs
@cd ./docs/_build/html && zip -r ../docs_html.zip . -x ".*" -x "__MACOSX"
@echo "$(ATTN_COLOR)==> Docs pages can be found at ./docs/_build/html, docs bundle available at ./docs/_build/docs_html.zip"
.PHONY: test
test:
@echo "$(ATTN_COLOR)==> test $(NO_COLOR)"
@tox -e py27,py37
.PHONY: test_specific
test_specific:
@echo "$(ATTN_COLOR)==> test_specific $(NO_COLOR)"
@sh ./scripts/test_specific.sh
.PHONY: test_smoke
test_smoke:
@echo "$(ATTN_COLOR)==> test_smoke $(NO_COLOR)"
@tox -e py27,py37 -- -m smoke
.PHONY: test_no_app
test_no_app:
@echo "$(ATTN_COLOR)==> test_no_app $(NO_COLOR)"
@tox -e py27,py37 -- -m "not app"
.PHONY: test_smoke_no_app
test_smoke_no_app:
@echo "$(ATTN_COLOR)==> test_smoke_no_app $(NO_COLOR)"
@tox -e py27,py37 -- -m "smoke and not app"
.PHONY: splunkrc
splunkrc:
@echo "$(ATTN_COLOR)==> splunkrc $(NO_COLOR)"
@echo "To make a .splunkrc:"
@echo " [SPLUNK_INSTANCE_JSON] | python scripts/build-splunkrc.py ~/.splunkrc"
.PHONY: splunkrc_default
splunkrc_default:
@echo "$(ATTN_COLOR)==> splunkrc_default $(NO_COLOR)"
@python scripts/build-splunkrc.py ~/.splunkrc
.PHONY: up
up:
@echo "$(ATTN_COLOR)==> up $(NO_COLOR)"
@docker-compose up -d
.PHONY: remove
remove:
@echo "$(ATTN_COLOR)==> rm $(NO_COLOR)"
@docker-compose rm -f -s
.PHONY: wait_up
wait_up:
@echo "$(ATTN_COLOR)==> wait_up $(NO_COLOR)"
@for i in `seq 0 180`; do if docker exec -it $(CONTAINER_NAME) /sbin/checkstate.sh &> /dev/null; then break; fi; printf "\rWaiting for Splunk for %s seconds..." $$i; sleep 1; done
.PHONY: down
down:
@echo "$(ATTN_COLOR)==> down $(NO_COLOR)"
@docker-compose stop
.PHONY: start
start: up wait_up
.PHONY: restart
restart: down start
.PHONY: refresh
refresh: remove start