generated from dnnrly/goclitem
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
93 lines (66 loc) · 2.53 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
GO111MODULE=on
CURL_BIN ?= curl
GO_BIN ?= go
GORELEASER_BIN ?= goreleaser
PUBLISH_PARAM?=
GO_MOD_PARAM?=-mod vendor
TMP_DIR?=./tmp
BASE_DIR=$(shell pwd)
NAME=hoofli
export GO111MODULE=on
export GOPROXY=https://proxy.golang.org
export PATH := $(BASE_DIR)/bin:$(PATH)
.PHONY: install deps clean clean-deps test-deps build-deps deps test acceptance-test ci-test lint release update
install: ## install hoofli from the current working tree
$(GO_BIN) install -v .
build: ## build hoofli
$(GO_BIN) build -v -o ./$(NAME) ./cmd/$(NAME)
clean: ## remove build artifacts from the working tree
rm -f $(NAME)
rm -rf dist/
rm -rf cmd/$(NAME)/dist
clean-deps: ## remove dependencies in the working tree
rm -rf ./bin
rm -rf ./tmp
rm -rf ./libexec
rm -rf ./share
./bin/golangci-lint:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.37.1
./bin/tparse: ./bin ./tmp
curl --fail -L -o ./tmp/tparse.tar.gz https://github.com/mfridman/tparse/releases/download/v0.8.3/tparse_0.8.3_Linux_x86_64.tar.gz
tar -xf ./tmp/tparse.tar.gz -C ./bin
./bin/godog: ./bin ./tmp
curl --fail -L -o ./tmp/godog.tar.gz https://github.com/cucumber/godog/releases/download/v0.11.0/godog-v0.11.0-linux-amd64.tar.gz
tar -xf ./tmp/godog.tar.gz -C ./tmp
cp ./tmp/godog-v0.11.0-linux-amd64/godog ./bin
test-deps: ./bin/godog ./bin/tparse ./bin/golangci-lint ## ci target - install test dependencies
$(GO_BIN) get -v ./...
$(GO_BIN) mod tidy
./bin:
mkdir ./bin
./tmp:
mkdir ./tmp
./bin/goreleaser: ./bin ./tmp
$(CURL_BIN) --fail -L -o ./tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v0.168.2/goreleaser_Linux_x86_64.tar.gz
gunzip -f ./tmp/goreleaser.tar.gz
tar -C ./bin -xvf ./tmp/goreleaser.tar
build-deps: ./bin/goreleaser ## ci target - install build dependencies
deps: build-deps test-deps ## ci target - install build and test dependencies
test: ## run unit tests with tparse prettifying
$(GO_BIN) test -json ./... | tparse -all
acceptance-test: ## run acceptance tests on built hoofli
cd test && godog -t @Acceptance
ci-test: ## ci target - run unit tests
$(GO_BIN) test -race -coverprofile=coverage.txt -covermode=atomic ./...
lint: ## run linting
golangci-lint run
release: clean ## ci target - release hoofli
cd cmd/$(NAME) ; $(GORELEASER_BIN) $(PUBLISH_PARAM)
update: ## update dependencies
$(GO_BIN) get -u
$(GO_BIN) mod tidy
make test
make install
$(GO_BIN) mod tidy
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/:.\+##/ --/'