forked from pganalyze/collector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (39 loc) · 1.7 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
OUTFILE := pganalyze-collector
PROTOBUF_FILES := $(wildcard protobuf/*.proto) $(wildcard protobuf/reports/*.proto)
PROTOC_VERSION := $(shell protoc --version 2>/dev/null)
.PHONY: default build build_dist vendor test docker_latest packages integration_test
default: build test
build: output/pganalyze_collector/snapshot.pb.go build_dist
build_dist:
go build -o ${OUTFILE}
make -C helper OUTFILE=../pganalyze-collector-helper
make -C setup OUTFILE=../pganalyze-collector-setup
build_dist_alpine:
# Increase stack size from Alpine's default of 80kb to 2mb - otherwise we see
# crashes on very complex queries, pg_query expects at least 100kb stack size
go build -o ${OUTFILE} -ldflags '-extldflags "-Wl,-z,stack-size=0x200000"'
make -C helper OUTFILE=../pganalyze-collector-helper
make -C setup OUTFILE=../pganalyze-collector-setup
vendor:
GO111MODULE=on go mod tidy
# You might need to run "go get -u github.com/goware/modvendor"
GO111MODULE=on go mod vendor
modvendor -copy="**/*.c **/*.h **/*.proto" -v
test: build
go test -coverprofile=coverage.out ./...
# go tool cover -html=coverage.out
integration_test:
make -C integration_test
packages:
make -C packages
docker_latest:
docker build -t quay.io/pganalyze/collector:latest .
docker push quay.io/pganalyze/collector:latest
output/pganalyze_collector/snapshot.pb.go: $(PROTOBUF_FILES)
ifdef PROTOC_VERSION
mkdir -p $(PWD)/bin
GOBIN=$(PWD)/bin go install github.com/golang/protobuf/protoc-gen-go
PATH=$(PWD)/bin:$(PATH) protoc --go_out=Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp:output/pganalyze_collector -I protobuf $(PROTOBUF_FILES)
else
@echo 'Warning: protoc not found, skipping protocol buffer regeneration'
endif