github.com/orange-cloudfoundry/cli@v7.1.0+incompatible/Makefile (about) 1 CF_DIAL_TIMEOUT ?= 15 2 NODES ?= 10 3 PACKAGES ?= api actor command types util version integration/helpers 4 LC_ALL = "en_US.UTF-8" 5 6 CF_BUILD_VERSION ?= $$(cat BUILD_VERSION) # TODO: version specific 7 CF_BUILD_SHA ?= $$(git rev-parse --short HEAD) 8 CF_BUILD_DATE ?= $$(date -u +"%Y-%m-%d") 9 LD_FLAGS_COMMON=-w -s \ 10 -X code.cloudfoundry.org/cli/version.binarySHA=$(CF_BUILD_SHA) \ 11 -X code.cloudfoundry.org/cli/version.binaryBuildDate=$(CF_BUILD_DATE) 12 LD_FLAGS =$(LD_FLAGS_COMMON) \ 13 -X code.cloudfoundry.org/cli/version.binaryVersion=$(CF_BUILD_VERSION) 14 LD_FLAGS_LINUX = -extldflags \"-static\" $(LD_FLAGS) 15 REQUIRED_FOR_STATIC_BINARY =-a -tags "netgo" -installsuffix netgo 16 GOSRC = $(shell find . -name "*.go" ! -name "*test.go" ! -name "*fake*" ! -path "./integration/*") 17 UNAME_S := $(shell uname -s) 18 19 20 TARGET = v7 21 SLOW_SPEC_THRESHOLD=120 22 23 GINKGO_FLAGS=-r -randomizeAllSpecs -requireSuite 24 GINKGO_INT_FLAGS=$(GINKGO_FLAGS) -slowSpecThreshold $(SLOW_SPEC_THRESHOLD) 25 ginkgo_int = ginkgo $(GINKGO_INT_FLAGS) 26 27 GINKGO_UNITS_FLAGS=$(GINKGO_FLAGS) -randomizeSuites -p 28 ginkgo_units = ginkgo $(GINKGO_UNITS_FLAGS) 29 30 all: lint test build 31 32 build: out/cf ## Compile and build a new `cf` binary 33 34 check-target-env: 35 ifndef CF_INT_API 36 $(error CF_INT_API is undefined) 37 endif 38 ifndef CF_INT_PASSWORD 39 $(error CF_INT_PASSWORD is undefined) 40 endif 41 42 clean: ## Just remove all cf* files from the `out` directory 43 rm -f $(wildcard out/cf*) 44 45 clear: clean ## Make everyone happy 46 47 custom-lint: ## Run our custom linters 48 @echo "Running custom linters..." # this list will grow as we cleanup all the code: 49 bash -c "go run bin/style/main.go api util" 50 @echo "No custom lint errors!" 51 @echo 52 53 # TODO: update these fly-windows* to point at the correct CI repo 54 fly-windows-experimental: check-target-env 55 CF_TEST_SUITE=./integration/shared/experimental fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./ --tag "cli-windows" 56 57 fly-windows-isolated: check-target-env 58 CF_TEST_SUITE=./integration/shared/isolated fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./ --tag "cli-windows" 59 60 fly-windows-plugin: check-target-env 61 CF_TEST_SUITE=./integration/shared/plugin fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./ --tag "cli-windows" 62 63 fly-windows-push: check-target-env 64 CF_TEST_SUITE=./integration/v6/push fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./ --tag "cli-windows" 65 66 fly-windows-global: check-target-env 67 CF_TEST_SUITE=./integration/shared/global fly -t ci execute -c ci/cli/tasks/integration-windows-serial.yml -i cli=./ --tag "cli-windows" 68 69 fly-windows-units: 70 fly -t ci execute -c ci/cli/tasks/units-windows.yml -i cli=./ -i cli-ci=./ --tag "cli-windows" 71 72 format: ## Run go fmt 73 go fmt ./... 74 75 integration-cleanup: 76 $(PWD)/bin/cleanup-integration 77 78 ie: integration-experimental 79 integration-experimental: build integration-cleanup integration-shared-experimental integration-experimental-versioned ## Run all experimental integration tests, both versioned and shared across versions 80 81 ise: integration-shared-experimental 82 integration-experimental-shared: integration-shared-experimental 83 integration-shared-experimental: build integration-cleanup ## Run experimental integration tests that are shared between v6 and v7 84 $(ginkgo_int) -nodes $(NODES) integration/shared/experimental 85 86 ive: integration-versioned-experimental 87 integration-experimental-versioned: integration-versioned-experimental 88 integration-versioned-experimental: build integration-cleanup ## Run experimental integration tests that are specific to your CLI version 89 $(ginkgo_int) -nodes $(NODES) integration/$(TARGET)/experimental 90 91 ig: integration-global 92 integration-global: build integration-cleanup integration-shared-global integration-global-versioned ## Run all unparallelizable integration tests that make cross-cutting changes to their test CF foundation 93 94 isg: integration-shared-global 95 integration-global-shared: integration-shared-global 96 integration-shared-global: build integration-cleanup ## Serially run integration tests that make cross-cutting changes to their test CF foundation and are shared between v6 and v7 97 $(ginkgo_int) integration/shared/global 98 99 ivg: integration-versioned-global 100 integration-global-versioned: integration-versioned-global 101 integration-versioned-global: build integration-cleanup ## Serially run integration tests that make cross-cutting changes to their test CF foundation and are specific to your CLI version 102 $(ginkgo_int) integration/$(TARGET)/global 103 104 ii: integration-isolated 105 integration-isolated: build integration-cleanup integration-shared-isolated integration-isolated-versioned ## Run all parallel-enabled integration tests, both versioned and shared across versions 106 107 isi: integration-shared-isolated 108 integration-isolated-shared: integration-shared-isolated 109 integration-shared-isolated: build integration-cleanup ## Run all parallel-enabled integration tests that are shared between v6 and v7 110 $(ginkgo_int) -nodes $(NODES) integration/shared/isolated 111 112 integration-performance: build integration-cleanup integration-shared-performance 113 114 isp: integration-shared-performance 115 integration-performance-shared: integration-shared-performance 116 integration-shared-performance: build integration-cleanup 117 $(ginkgo_int) integration/shared/performance 118 119 ivi: integration-versioned-isolated 120 integration-isolated-versioned: integration-versioned-isolated 121 integration-versioned-isolated: build integration-cleanup ## Run all parallel-enabled integration tests, both versioned and shared across versions 122 $(ginkgo_int) -nodes $(NODES) integration/$(TARGET)/isolated 123 124 integration-plugin: build integration-cleanup ## Run all plugin-related integration tests 125 $(ginkgo_int) -nodes $(NODES) integration/shared/plugin 126 127 ip: integration-push 128 integration-push: build integration-cleanup ## Run all push-related integration tests 129 $(ginkgo_int) -nodes $(NODES) integration/$(TARGET)/push 130 131 integration-tests: build integration-cleanup integration-isolated integration-push integration-global ## Run all isolated, push, and global integration tests 132 133 i: integration-tests-full 134 integration-full-tests: integration-tests-full 135 integration-tests-full: build integration-cleanup integration-isolated integration-push integration-experimental integration-plugin integration-global ## Run all isolated, push, experimental, plugin, and global integration tests 136 137 lint: custom-lint ## Runs all linters and formatters 138 @echo "Running linters..." 139 go list -f "{{.Dir}}" ./... \ 140 | grep -v -e "/cf/" -e "/fixtures/" -e "/assets/" -e "/plugin/" -e "/command/plugin" -e "fakes" \ 141 | xargs golangci-lint run 142 @echo "No lint errors!" 143 144 # TODO: version specific tagging for all these builds 145 # Build dynamic binary for Darwin 146 ifeq ($(UNAME_S),Darwin) 147 out/cf: $(GOSRC) 148 go build -ldflags "$(LD_FLAGS)" -o out/cf . 149 else 150 out/cf: $(GOSRC) 151 CGO_ENABLED=0 go build \ 152 $(REQUIRED_FOR_STATIC_BINARY) \ 153 -ldflags "$(LD_FLAGS_LINUX)" -o out/cf . 154 endif 155 156 out/cf-cli_linux_i686: $(GOSRC) 157 CGO_ENABLED=0 GOARCH=386 GOOS=linux go build \ 158 $(REQUIRED_FOR_STATIC_BINARY) \ 159 -ldflags "$(LD_FLAGS_LINUX)" -o out/cf-cli_linux_i686 . 160 161 out/cf-cli_linux_x86-64: $(GOSRC) 162 CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build \ 163 $(REQUIRED_FOR_STATIC_BINARY) \ 164 -ldflags "$(LD_FLAGS_LINUX)" -o out/cf-cli_linux_x86-64 . 165 166 out/cf-cli_osx: $(GOSRC) 167 GOARCH=amd64 GOOS=darwin go build \ 168 -a -ldflags "$(LD_FLAGS)" -o out/cf-cli_osx . 169 170 out/cf-cli_win32.exe: $(GOSRC) rsrc.syso 171 GOARCH=386 GOOS=windows go build -tags="forceposix" -o out/cf-cli_win32.exe -ldflags "$(LD_FLAGS)" . 172 rm rsrc.syso 173 174 out/cf-cli_winx64.exe: $(GOSRC) rsrc.syso 175 GOARCH=amd64 GOOS=windows go build -tags="forceposix" -o out/cf-cli_winx64.exe -ldflags "$(LD_FLAGS)" . 176 rm rsrc.syso 177 178 rsrc.syso: 179 @# Software for windows icon 180 go get github.com/akavel/rsrc 181 @# Generates icon file 182 rsrc -ico cf.ico 183 184 test: units ## (synonym for units) 185 186 units: units-full ## (synonym for units-full) 187 188 units-plugin: 189 CF_HOME=$(PWD)/fixtures $(ginkgo_units) -nodes 1 -flakeAttempts 2 -skipPackage integration ./**/plugin* ./plugin 190 191 units-non-plugin: 192 @rm -f $(wildcard fixtures/plugins/*.exe) 193 @ginkgo version 194 CF_HOME=$(PWD)/fixtures CF_USERNAME="" CF_PASSWORD="" $(ginkgo_units) \ 195 -skipPackage integration,cf/ssh,plugin,cf/actors/plugin,cf/commands/plugin,cf/actors/plugin 196 CF_HOME=$(PWD)/fixtures $(ginkgo_units) -flakeAttempts 3 cf/ssh 197 198 units-full: build units-plugin units-non-plugin 199 @echo "\nSWEET SUITE SUCCESS" 200 201 version: ## Print the version number of what would be built 202 @echo $(CF_BUILD_VERSION)+$(CF_BUILD_SHA).$(CF_BUILD_DATE) 203 204 .PHONY: all build clean format version lint custom-lint 205 .PHONY: test units units-full integration integration-tests-full integration-cleanup integration-experimental integration-plugin integration-isolated integration-push 206 .PHONY: check-target-env fly-windows-experimental fly-windows-isolated fly-windows-plugin fly-windows-push 207 .PHONY: help 208 209 help: 210 @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-34s\033[0m %s\n", $$1, $$2}'