-
Notifications
You must be signed in to change notification settings - Fork 66
/
Makefile
67 lines (54 loc) · 1.54 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
# Go parameters
GOCMD=GO111MODULE=on go
GOBUILD=$(GOCMD) build
GOINSTALL=$(GOCMD) install
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test -count=1
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
GOFMT=$(GOCMD) fmt
GODOC=godoc
.PHONY: all test coverage
all: test coverage examples
get:
$(GOGET) -t -v ./redisearch/...
TLS_CERT ?= redis.crt
TLS_KEY ?= redis.key
TLS_CACERT ?= ca.crt
REDISEARCH_TEST_HOST ?= 127.0.0.1:6379
checkfmt:
@echo 'Checking gofmt';\
bash -c "diff -u <(echo -n) <(gofmt -d .)";\
EXIT_CODE=$$?;\
if [ "$$EXIT_CODE" -ne 0 ]; then \
echo '$@: Go files must be formatted with gofmt'; \
fi && \
exit $$EXIT_CODE
examples: get
@echo " "
@echo "Building the examples..."
$(GOBUILD) ./examples/redisearch_quickstart/.
$(GOBUILD) ./examples/redisearch_auth/.
$(GOBUILD) ./examples/redisearch_geo/.
$(GOBUILD) ./examples/redisearch_tls_client/.
$(GOBUILD) ./examples/redisearch_temporary_index/.
./redisearch_tls_client --tls-cert-file $(TLS_CERT) \
--tls-key-file $(TLS_KEY) \
--tls-ca-cert-file $(TLS_CACERT) \
--host $(REDISEARCH_TEST_HOST)
fmt:
$(GOFMT) ./...
godoc_examples: get fmt
$(GOTEST) -race -covermode=atomic ./redisearch
test: get fmt
$(GOTEST) -run "Test" ./redisearch
coverage: get
$(GOTEST) -race -coverprofile=coverage.txt -covermode=atomic ./redisearch
godoc:
$(GOGET) -u golang.org/x/tools/...
echo "Open browser tab on localhost:6060"
$(GODOC)
start-redis:
$(docker) run --name redisearch-go-tests -d --rm -p 6379:6379 redislabs/redisearch:edge
stop-redis:
$(docker) stop redisearch-go-tests