-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
61 lines (48 loc) · 1.33 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
COMMIT_SHA ?= $(shell git rev-parse HEAD)
REPONAME ?= metrico
IMAGE_NAME ?= "otel-collector"
CONFIG_FILE ?= ./config/example-config.yaml
DOCKER_TAG ?= latest
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
GOPATH ?= $(shell go env GOPATH)
GOTEST=go test -v $(RACE)
GOFMT=gofmt
FMT_LOG=.fmt.log
IMPORT_LOG=.import.log
.PHONY: install-tools
install-tools:
go mod tidy
go install github.com/golangci/golangci-lint/cmd/[email protected]
.DEFAULT_GOAL := test-and-lint
.PHONY: test-and-lint
test-and-lint: test fmt lint
.PHONY: test
test:
go test -count=1 -v -race -cover ./...
.PHONY: build
build:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o otel-collector ./cmd/otel-collector
.PHONY: run
run:
go run cmd/otel-collector/*.go --config ${CONFIG_FILE}
.PHONY: fmt
fmt:
@echo Running go fmt on query service ...
@$(GOFMT) -e -s -l -w .
.PHONY: build-qryn-collector
build-qryn-collector:
@echo "------------------"
@echo "--> Building qryn collector docker image"
@echo "------------------"
docker buildx build --progress plane \
--no-cache -f cmd/otel-collector/Dockerfile \
--tag $(REPONAME)/$(IMAGE_NAME):$(DOCKER_TAG) .
.PHONY: lint
lint:
@echo "Running linters..."
@$(GOPATH)/bin/golangci-lint -v --config .golangci.yml run && echo "Done."
.PHONY: install-ci
install-ci: install-tools
.PHONY: test-ci
test-ci: lint