-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (43 loc) · 1.52 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
SHELL := bash
# Directory, where all required tools are located (absolute path required)
TOOLS_DIR ?= $(shell cd tools && pwd)
# Prerequisite tools
GO ?= go
DOCKER ?= docker
# Tools managed by this project
GINKGO ?= $(TOOLS_DIR)/ginkgo
LINTER ?= $(TOOLS_DIR)/golangci-lint
GOVERALLS ?= $(TOOLS_DIR)/goveralls
GOVER ?= $(TOOLS_DIR)/gover
.EXPORT_ALL_VARIABLES:
.PHONY: test lint fmt vet
test: fmt vet docker-is-running $(GINKGO)
$(GINKGO) -r -v -cover pkg -- $(TEST_FLAGS)
test-%: fmt vet docker-is-running $(GINKGO)
$(GINKGO) -r -v -cover pkg/$* -- $(TEST_FLAGS)
# First run gover to merge the coverprofiles and upload to coveralls
coverage: $(GOVERALLS) $(GOVER)
$(GOVER)
$(GOVERALLS) -coverprofile=gover.coverprofile -service=travis-ci -repotoken $(COVERALLS_TOKEN)
lint: $(LINTER)
$(GO) mod verify
$(LINTER) run -v --no-config --deadline=5m
fmt:
$(GO) fmt ./...
vet:
$(GO) vet ./...
docker-is-running:
@echo "Checking if docker is running..."
@{ \
set -e; \
$(DOCKER) version > /dev/null; \
}
tools: $(TOOLS_DIR)/ginkgo $(TOOLS_DIR)/golangci-lint $(TOOLS_DIR)/goveralls $(TOOLS_DIR)/gover
$(TOOLS_DIR)/ginkgo:
$(shell $(TOOLS_DIR)/goget-wrapper github.com/onsi/ginkgo/ginkgo@v1.12.0)
$(TOOLS_DIR)/golangci-lint:
$(shell curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_DIR) v1.25.0)
$(TOOLS_DIR)/goveralls:
$(shell $(TOOLS_DIR)/goget-wrapper github.com/mattn/goveralls@v0.0.5)
$(TOOLS_DIR)/gover:
$(shell $(TOOLS_DIR)/goget-wrapper github.com/modocache/gover)