-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (48 loc) · 1.44 KB
/
Makefile
File metadata and controls
57 lines (48 loc) · 1.44 KB
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
.PHONY: install
install: $(GOPATH)/bin/spec $(GOPATH)/bin/specfmt
$(GOPATH)/bin/spec:
@go install github.com/endiangroup/specstack/cmd/spec
$(GOPATH)/bin/specfmt:
@go install github.com/endiangroup/specstack/cmd/specfmt
.PHONY: clean
clean:
@rm -rf vendor $(GOPATH)/bin/spec $(GOPATH)/bin/specfmt
.PHONY: test
test: godog
go test ./...
(cd cmd/ && godog ../features)
.PHONY: lint
lint: golangci-lint $(GOPATH)/bin/specfmt
golangci-lint run ./...
specfmt -l features/*.feature
.PHONY: mock
dir ?= .
mock: export filename=$(shell echo $(name) | tr A-Z a-z)_mock.go
mock: mockery
ifndef name
@echo "Please specify an interface name: $ make mock name=MyInterface"
exit 1
endif
@echo "Generating mock for $(dir)/$(name)..."
@cd $(dir) && mockery -inpkg -print -name $(name) >_$(filename)
@cd $(dir) && mv _$(filename) $(filename)
.PHONY: mockery
MOCKERY_BIN := $(shell command -v mockery 2> /dev/null)
mockery:
ifndef MOCKERY_BIN
@echo "Installing mockery..."
@go get github.com/vektra/mockery/cmd/mockery
endif
.PHONY: godog
GODOG_BIN := $(shell command -v godog 2> /dev/null)
godog:
ifndef GODOG_BIN
@echo "Installing godog..."
@go install github.com/cucumber/godog/cmd/godog@v0.14.1
endif
.PHONY: golangci-lint
GOLANGCI_BIN := $(shell command -v golangci-lint 2> /dev/null)
golangci-lint:
ifndef GOLANGCI_BIN
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.58.1
endif