11exe = cmd/commander/*
22cmd = commander
3- TRAVIS_TAG ?= "0.0.0"
3+ GIT_RELEASE_TAG ?= "0.0.0"
44CWD = $(shell pwd)
55
6- .PHONY : deps lint test integration integration-windows git-hooks init
7-
6+ .PHONY : init
87init : git-hooks
98
9+ .PHONY : git-hooks
1010git-hooks :
1111 $(info INFO: Starting build $@ )
1212 ln -sf ../../.githooks/pre-commit .git/hooks/pre-commit
1313
14+ .PHONY : deps
1415deps :
1516 $(info INFO: Starting build $@ )
1617 go mod vendor
1718
19+ .PHONY : build
1820build :
1921 $(info INFO: Starting build $@ )
2022 go build $(exe )
2123
24+ .PHONY : lint
2225lint :
2326 $(info INFO: Starting build $@ )
2427 golint pkg/ cmd/
2528
29+ .PHONY : test
2630test :
2731 $(info INFO: Starting build $@ )
2832 go test ./...
2933
34+ .PHONY : test-coverage
3035test-coverage :
3136 $(info INFO: Starting build $@ )
3237 go test -coverprofile c.out ./...
3338
39+ .PHONY : test-coverage-all-dockerized
40+ test-coverage-all-dockerized :
41+ $(info INFO: Starting build $@ )
42+ ./test.sh
43+
44+ .PHONY : test-coverage-all-dockerized-with-codeclimate
45+ test-coverage-all-dockerized-with-codeclimate :
46+ $(info INFO: Starting build $@ )
47+ CC_TEST_REPORTER_ID=${CC_TEST_REPORTER_ID} ./test.sh
3448
3549test-coverage-all : export COMMANDER_TEST_ALL = 1
3650test-coverage-all : export COMMANDER_SSH_TEST = 1
37- test-coverage-all : export COMMANDER_TEST_SSH_HOST = localhost:2222
51+ test-coverage-all : export COMMANDER_TEST_SSH_HOST = 172.28.0.2:22
3852test-coverage-all : export COMMANDER_TEST_SSH_USER = root
3953test-coverage-all : export COMMANDER_TEST_SSH_IDENTITY_FILE = $(CWD ) /integration/containers/ssh/id_rsa
54+ .PHONY : test-coverage-all
4055test-coverage-all :
4156 $(info INFO: Starting build $@ )
42- ./integration/setup_unix.sh
4357 go test -coverprofile c.out ./...
44- ./integration/teardown_unix.sh
4558
59+ test-coverage-all : export COMMANDER_TEST_ALL = 1
60+ test-coverage-all : export COMMANDER_SSH_TEST = 1
61+ test-coverage-all : export COMMANDER_TEST_SSH_HOST = 172.28.0.2:22
62+ test-coverage-all : export COMMANDER_TEST_SSH_USER = root
63+ test-coverage-all : export COMMANDER_TEST_SSH_IDENTITY_FILE = $(CWD ) /integration/containers/ssh/id_rsa
64+ .PHONY : test-coverage-all-codeclimate
65+ test-coverage-all-codeclimate :
66+ $(info INFO: Starting build $@ )
67+ ./test-reporter before-build
68+ go test -coverprofile c.out ./...; \
69+ ./test-reporter after-build -t gocov --prefix=github.com/commander-cli/commander --exit-code $$?
70+
71+ .PHONY : integration-unix
4672integration-unix : build
4773 $(info INFO: Starting build $@ )
4874 commander test commander_unix.yaml
4975
76+ .PHONY : integration-linux
5077integration-linux : build
5178 $(info INFO: Starting build $@ )
52- ./integration/setup_unix.sh
53- commander test commander_unix.yaml
54- commander test commander_linux.yaml
55- ./integration/teardown_unix.sh
79+ DOCKER_HOST=${DOCKER_HOST} DOCKER_CERT_PATH=${DOCKER_CERT_PATH} commander test commander_unix.yaml
80+ DOCKER_HOST=${DOCKER_HOST} DOCKER_CERT_PATH=${DOCKER_CERT_PATH} commander test commander_linux.yaml --verbose
5681
82+ .PHONY : integration-linux-dockerized
83+ integration-linux-dockerized :
84+ $(info INFO: Starting build $@ )
85+ ./test.sh integration-linux
86+
87+ .PHONY : integration-windows
5788integration-windows : build
5889 $(info INFO: Starting build $@ )
5990 commander test commander_windows.yaml
6091
6192release-amd64 :
6293 $(info INFO: Starting build $@ )
63- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags " -X main.version=$( TRAVIS_TAG ) -s -w" -o release/$(cmd ) -linux-amd64 $(exe )
94+ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags " -X main.version=$( GIT_RELEASE_TAG ) -s -w" -o release/$(cmd ) -linux-amd64 $(exe )
6495
6596release-arm :
6697 $(info INFO: Starting build $@ )
67- CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags " -X main.version=$( TRAVIS_TAG ) -s -w" -o release/$(cmd ) -linux-arm $(exe )
98+ CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags " -X main.version=$( GIT_RELEASE_TAG ) -s -w" -o release/$(cmd ) -linux-arm $(exe )
6899
69100release-386 :
70101 $(info INFO: Starting build $@ )
71- CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags " -X main.version=$( TRAVIS_TAG ) -s -w" -o release/$(cmd ) -linux-386 $(exe )
102+ CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags " -X main.version=$( GIT_RELEASE_TAG ) -s -w" -o release/$(cmd ) -linux-386 $(exe )
72103
73104release-darwin-amd64 :
74105 $(info INFO: Starting build $@ )
75- CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags " -X main.version=$( TRAVIS_TAG ) -s -w" -o release/$(cmd ) -darwin-amd64 $(exe )
106+ CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags " -X main.version=$( GIT_RELEASE_TAG ) -s -w" -o release/$(cmd ) -darwin-amd64 $(exe )
76107
77108release-darwin-386 :
78109 $(info INFO: Starting build $@ )
79- CGO_ENABLED=0 GOOS=darwin GOARCH=386 go build -ldflags " -X main.version=$( TRAVIS_TAG ) -s -w" -o release/$(cmd ) -darwin-386 $(exe )
110+ CGO_ENABLED=0 GOOS=darwin GOARCH=386 go build -ldflags " -X main.version=$( GIT_RELEASE_TAG ) -s -w" -o release/$(cmd ) -darwin-386 $(exe )
80111
81112release-windows-amd64 :
82113 $(info INFO: Starting build $@ )
83- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags " -X main.version=$( TRAVIS_TAG ) -s -w" -o release/$(cmd ) -windows-amd64.exe $(exe )
114+ 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 )
84115
85116release-windows-386 :
86117 $(info INFO: Starting build $@ )
87- CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags " -X main.version=$( TRAVIS_TAG) -s -w" -o release/$(cmd ) -windows-386.exe $(exe )
88-
118+ 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 )
89119
90- release : release-amd64 release-arm release-386 release-darwin-amd64 release-darwin-386 release-windows-amd64 release-windows-386
120+ release : release-amd64 release-arm release-386 release-darwin-amd64 release-darwin-386 release-windows-amd64 release-windows-386
0 commit comments