-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
120 lines (97 loc) · 4 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
exe = cmd/commander/*
cmd = commander
GIT_RELEASE_TAG ?= "0.0.0"
CWD = $(shell pwd)
.PHONY: init
init: git-hooks
.PHONY: git-hooks
git-hooks:
$(info INFO: Starting build $@)
ln -sf ../../.githooks/pre-commit .git/hooks/pre-commit
.PHONY: deps
deps:
$(info INFO: Starting build $@)
go mod vendor
.PHONY: build
build:
$(info INFO: Starting build $@)
go build $(exe)
.PHONY: lint
lint:
$(info INFO: Starting build $@)
golint pkg/ cmd/
.PHONY: test
test:
$(info INFO: Starting build $@)
go test ./...
.PHONY: test-coverage
test-coverage:
$(info INFO: Starting build $@)
go test -coverprofile c.out ./...
.PHONY: test-coverage-all-dockerized
test-coverage-all-dockerized:
$(info INFO: Starting build $@)
./test.sh
.PHONY: test-coverage-all-dockerized-with-codeclimate
test-coverage-all-dockerized-with-codeclimate:
$(info INFO: Starting build $@)
CC_TEST_REPORTER_ID=${CC_TEST_REPORTER_ID} ./test.sh
test-coverage-all: export COMMANDER_TEST_ALL = 1
test-coverage-all: export COMMANDER_SSH_TEST = 1
test-coverage-all: export COMMANDER_TEST_SSH_HOST = 172.28.0.2:22
test-coverage-all: export COMMANDER_TEST_SSH_USER = root
test-coverage-all: export COMMANDER_TEST_SSH_IDENTITY_FILE = $(CWD)/integration/containers/ssh/id_rsa
.PHONY: test-coverage-all
test-coverage-all:
$(info INFO: Starting build $@)
go test -coverprofile c.out ./...
test-coverage-all: export COMMANDER_TEST_ALL = 1
test-coverage-all: export COMMANDER_SSH_TEST = 1
test-coverage-all: export COMMANDER_TEST_SSH_HOST = 172.28.0.2:22
test-coverage-all: export COMMANDER_TEST_SSH_USER = root
test-coverage-all: export COMMANDER_TEST_SSH_IDENTITY_FILE = $(CWD)/integration/containers/ssh/id_rsa
.PHONY: test-coverage-all-codeclimate
test-coverage-all-codeclimate:
$(info INFO: Starting build $@)
./test-reporter before-build
go test -coverprofile c.out ./...; \
./test-reporter after-build -t gocov --prefix=github.com/commander-cli/commander/v2 --exit-code $$?
.PHONY: integration-unix
integration-unix: build
$(info INFO: Starting build $@)
commander test commander_unix.yaml
.PHONY: integration-linux
integration-linux: build
$(info INFO: Starting build $@)
DOCKER_HOST=${DOCKER_HOST} DOCKER_CERT_PATH=${DOCKER_CERT_PATH} commander test commander_unix.yaml
DOCKER_HOST=${DOCKER_HOST} DOCKER_CERT_PATH=${DOCKER_CERT_PATH} commander test commander_linux.yaml --verbose
.PHONY: integration-linux-dockerized
integration-linux-dockerized:
$(info INFO: Starting build $@)
./test.sh integration-linux
.PHONY: integration-windows
integration-windows: build
$(info INFO: Starting build $@)
commander test commander_windows.yaml
release-amd64:
$(info INFO: Starting build $@)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=$(GIT_RELEASE_TAG) -s -w" -o release/$(cmd)-linux-amd64 $(exe)
release-arm:
$(info INFO: Starting build $@)
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags "-X main.version=$(GIT_RELEASE_TAG) -s -w" -o release/$(cmd)-linux-arm $(exe)
release-386:
$(info INFO: Starting build $@)
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-X main.version=$(GIT_RELEASE_TAG) -s -w" -o release/$(cmd)-linux-386 $(exe)
release-darwin-arm64:
$(info INFO: Starting build $@)
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.version=$(GIT_RELEASE_TAG) -s -w" -o release/$(cmd)-darwin-arm64 $(exe)
release-darwin-amd64:
$(info INFO: Starting build $@)
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=$(GIT_RELEASE_TAG) -s -w" -o release/$(cmd)-darwin-amd64 $(exe)
release-windows-amd64:
$(info INFO: Starting build $@)
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=$(GIT_RELEASE_TAG) -s -w" -o release/$(cmd)-windows-amd64.exe $(exe)
release-windows-386:
$(info INFO: Starting build $@)
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-X main.version=$(GIT_RELEASE_TAG) -s -w" -o release/$(cmd)-windows-386.exe $(exe)
release: release-amd64 release-arm release-386 release-darwin-amd64 release-darwin-arm64 release-windows-amd64 release-windows-386