forked from open-telemetry/opamp-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
64 lines (47 loc) · 1.77 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
# Function to execute a command.
# Accepts command to execute as first parameter.
define exec-command
$(1)
endef
TOOLS_MOD_DIR := ./internal/tools
# Find all .proto files.
BASELINE_PROTO_FILES := $(wildcard internal/opamp-spec/proto/*.proto)
all: test build-examples
.PHONY: test
test:
go test -race ./...
cd internal/examples && go test -race ./...
.PHONY: test-with-cover
test-with-cover:
go-acc --output=coverage.out --ignore=protobufs ./...
show-coverage: test-with-cover
# Show coverage as HTML in the default browser.
go tool cover -html=coverage.out
.PHONY: build-examples
build-examples: build-example-agent build-example-supervisor build-example-server
build-example-agent:
cd internal/examples && go build -o agent/bin/agent agent/main.go
build-example-supervisor:
cd internal/examples && go build -o supervisor/bin/supervisor supervisor/main.go
build-example-server:
cd internal/examples && go build -o server/bin/server server/main.go
run-examples: build-examples
cd internal/examples/server && ./bin/server &
@echo Server UI is running at http://localhost:4321/
cd internal/examples/agent && ./bin/agent
OTEL_DOCKER_PROTOBUF ?= otel/build-protobuf:0.14.0
# Generate Protobuf Go files.
.PHONY: gen-proto
gen-proto:
mkdir -p ${PWD}/internal/proto/
$(foreach file,$(BASELINE_PROTO_FILES),$(call exec-command,docker run --rm -v${PWD}:${PWD} \
-w${PWD} $(OTEL_DOCKER_PROTOBUF) --proto_path=${PWD}/internal/opamp-spec/proto/ \
--go_out=${PWD}/internal/proto/ -I${PWD}/internal/proto/ ${PWD}/$(file)))
cp -R internal/proto/github.com/open-telemetry/opamp-go/protobufs/* protobufs/
rm -rf internal/proto/github.com/
.PHONY: gomoddownload
gomoddownload:
go mod download
.PHONY: install-tools
install-tools:
cd $(TOOLS_MOD_DIR) && go install github.com/ory/go-acc