-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (61 loc) · 1.93 KB
/
Copy pathMakefile
File metadata and controls
72 lines (61 loc) · 1.93 KB
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
# Go parameters
GOCMD=GO111MODULE=on go
GOBUILD=$(GOCMD) build
GOINSTALL=$(GOCMD) install
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
GOFMT=$(GOCMD) fmt
BIN_NAME=ftsb_redisearch
MODULE=ftsb_redisearch
DISTDIR = ./dist
.PHONY: ftsb_redisearch
all: get ftsb_redisearch integration-test
# Build-time GIT variables
ifeq ($(GIT_SHA),)
GIT_SHA:=$(shell git rev-parse HEAD)
endif
ifeq ($(GIT_DIRTY),)
GIT_DIRTY:=$(shell git diff --no-ext-diff 2> /dev/null | wc -l)
endif
LDFLAGS = "-X 'main.GitSHA1=$(GIT_SHA)' -X 'main.GitDirty=$(GIT_DIRTY)'"
OS_ARCHs = linux/amd64 linux/arm64 linux/arm windows/amd64 darwin/amd64 darwin/arm64
build:
$(GOBUILD) \
-ldflags=$(LDFLAGS) ./cmd/ftsb_redisearch
fmt:
$(GOFMT) ./...
ftsb_redisearch:
$(GOBUILD) \
-ldflags=$(LDFLAGS) \
-o bin/ftsb_redisearch ./cmd/ftsb_redisearch
get:
$(GOGET) ./...
integration-test: get ftsb_redisearch
# -race instruments the test process so the benchmark_runner concurrency
# tests (e.g. TestRecordCmdStatConcurrentIsRaceFree, #116) actually detect a
# reintroduced data race.
$(GOTEST) -race -v $(shell go list ./... | grep -v '/cmd/')
# unit-test runs the pure-Go tests for the cmd packages, which integration-test
# excludes. These need no Redis, so they run standalone with the race detector.
unit-test: get
$(GOTEST) -v -race ./cmd/...
release:
@mkdir -p ${DISTDIR}
@for pair in $(OS_ARCHs); do \
os=$${pair%/*}; arch=$${pair#*/}; \
ext=""; \
if [ "$$os" = "windows" ]; then ext=".exe"; fi; \
out="${DISTDIR}/${BIN_NAME}_$${os}_$${arch}$${ext}"; \
echo "==> building $$os/$$arch -> $$out"; \
GOOS=$$os GOARCH=$$arch CGO_ENABLED=0 $(GOBUILD) \
-ldflags=$(LDFLAGS) \
-o $$out ./cmd/ftsb_redisearch || exit 1; \
done
publish: release
@for f in $(shell ls ${DISTDIR}); \
do \
echo "copying ${DISTDIR}/$${f}"; \
aws s3 cp ${DISTDIR}/$${f} s3://benchmarks.redislabs/redisearch/tools/ftsb/$${f} --acl public-read; \
done