-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (63 loc) · 2.26 KB
/
Makefile
File metadata and controls
76 lines (63 loc) · 2.26 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
73
74
75
76
OS=$(shell uname | tr '[:upper:]' '[:lower:]')
ARCH=$(shell uname -m)
BINARY=pbench
PLATFORMS=darwin linux
ARCHITECTURES=amd64 arm64
TAGS=
GO=go build -tags=$(TAGS)
.PHONY: $(BINARY)
$(BINARY): pre clean
$(GO) -o $(BINARY)_$(OS)_$(ARCH)
.PHONY: all
all: pre clean
@for goos in $(PLATFORMS); do \
for goarch in $(ARCHITECTURES); do \
echo "Building $$goos/$$goarch..."; \
CGO_ENABLED=0 GOOS=$$goos GOARCH=$$goarch $(GO) -o $(BINARY)_$${goos}_$${goarch} || exit 1; \
done; \
done
.PHONY: test
test:
gofmt -l . | (! grep .) || (echo "gofmt: above files are not formatted" && exit 1)
go vet ./...
staticcheck ./...
go test ./... -race -count=1 -timeout 120s
pre:
ifeq "$(shell which go)" ""
$(error No go in $$PATH)
endif
clean:
rm -rf $(BINARY)_* release
uninstall:
rm -f /usr/local/bin/$(BINARY)
install: pbench uninstall
ln -s $(CURDIR)/$(BINARY) /usr/local/bin/$(BINARY)
tar: clean all
mkdir -p release/$(BINARY)
cp -r $(BINARY) $(BINARY)_* clusters/params.json *.template.json clusters/templates release/$(BINARY)
cd release $(foreach GOOS, $(PLATFORMS),\
$(foreach GOARCH, $(ARCHITECTURES),\
&& tar -czf ../$(BINARY)_$(GOOS)_$(GOARCH).tar.gz \
$(BINARY)/$(BINARY) \
$(BINARY)/$(BINARY)_$(GOOS)_$(GOARCH) \
$(BINARY)/templates \
$(BINARY)/*.template.json \
$(BINARY)/params.json))
rm -rf release
.PHONY: release
release: check-version tar
gh release create v$(VERSION) --title "$(VERSION)" \
$(foreach GOOS, $(PLATFORMS),$(foreach GOARCH, $(ARCHITECTURES),$(BINARY)_$(GOOS)_$(GOARCH).tar.gz ))
.PHONY: check-version
check-version:
@if [ -z "$(VERSION)" ]; then echo "VERSION is required. Usage: make release VERSION=1.2"; exit 1; fi
upload:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags=influx -o $(BINARY)_linux_amd64
aws s3 cp $(BINARY)_linux_amd64 s3://presto-deploy-infra-and-cluster-a9d5d14
sync:
@if [ ! -d ../presto-performance/presto-deploy-cluster/clusters ]; then echo "Error: ../presto-performance/presto-deploy-cluster/clusters does not exist"; exit 1; fi
./pbench genconfig -t clusters/templates -p clusters/params.json ../presto-performance/presto-deploy-cluster/clusters
.PHONY: clusters
clusters:
@echo "Generating cluster configurations..."
./pbench genconfig -t clusters/templates -p clusters/params.json clusters