-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile
58 lines (45 loc) · 1.45 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
.PHONY: all
all: build fmt vet lint test
APP=consul-envoy-xds
ALL_PACKAGES=$(shell go list ./... | grep -v "vendor")
UNIT_TEST_PACKAGES=$(shell go list ./... | grep -v "featuretests")
APP_EXECUTABLE="./out/$(APP)"
setup-circleci:
sudo apt-get install unzip
wget https://releases.hashicorp.com/consul/1.2.3/consul_1.2.3_linux_amd64.zip
sudo unzip consul_1.2.3_linux_amd64.zip -d /usr/local/bin
setup:
go get -u golang.org/x/lint/golint
go get github.com/DATA-DOG/godog/cmd/godog
go get -u github.com/go-playground/overalls
go mod verify
go mod download
mkdir -p out/
go build -o $(APP_EXECUTABLE)
cp application.yml.sample application.yml
@echo "consul-envoy-xds is setup!! Run make test to run tests"
build-deps:
go mod download
compile:
mkdir -p out/
go build -o $(APP_EXECUTABLE)
build: build-deps compile fmt vet lint
install:
go install ./...
fmt:
go fmt ./...
vet:
go vet $(ALL_PACKAGES)
lint:
@for p in $(UNIT_TEST_PACKAGES); do \
echo "==> Linting $$p"; \
golint $$p | { grep -vwE "exported (var|function|method|type|const) \S+ should have comment" || true; } \
done
test: compile
ENVIRONMENT=test go test $(UNIT_TEST_PACKAGES) -p=1 -run W
test-coverage: compile
@echo "mode: count" > out/coverage-all.out
env ENVIRONMENT=test overalls -project consul-envoy-xds
find . -name "profile.coverprofile" -exec rm "{}" \;
mv overalls.coverprofile out/overalls.coverprofile
go tool cover -html=out/overalls.coverprofile -o out/coverage.html