-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
75 lines (58 loc) · 1.04 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
DIST_DIR ?= dist
.PHONY: all
all: clean build test
#
# Release targets
#
.PHONY: dry_release
dry_release: clean
goreleaser --skip-publish
#
# Test targets
#
.PHONY: test
test: unit_test integration_test
.PHONY: integration_test
integration_test:
go test \
-count=1 \
-v \
-timeout=5m \
-run=$(T) \
./pkg/test
.PHONY: unit_test
unit_test:
go test \
-race \
-cover \
-timeout=5s \
-run=$(T) \
$(shell go list ./... | grep -v pkg/test)
.PHONY: lint
lint:
golangci-lint run -c .golangci.yml
.PHONY: clean_docker
clean_docker:
-docker rm -f $(shell docker ps -a -q)
#
# Build targets
#
.PHONY: download
download:
go mod download
.PHONY: vendor
vendor:
go mod vendor
.PHONY: install
install:
mv $(DIST_DIR)/sind $(GOPATH)/bin/sind
.PHONY: build
build: clean dist binary
.PHONY: binary
binary:
CGO_ENABLED=0 go build -ldflags='-s -w -X "github.com/jlevesy/sind/pkg/cli.version=custom-$(shell git rev-parse --short HEAD)" ' -o $(DIST_DIR)/sind ./cmd/sind
dist:
mkdir -p $(DIST_DIR)
.PHONY: clean
clean:
rm -rf $(DIST_DIR)