github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+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) 7 CF_BUILD_VERSION_V7 ?= $$(cat BUILD_VERSION_V7) 8 CF_BUILD_SHA ?= $$(git rev-parse --short HEAD) 9 CF_BUILD_DATE ?= $$(date -u +"%Y-%m-%d") 10 LD_FLAGS_COMMON=-w -s \ 11 -X code.cloudfoundry.org/cli/version.binarySHA=$(CF_BUILD_SHA) \ 12 -X code.cloudfoundry.org/cli/version.binaryBuildDate=$(CF_BUILD_DATE) 13 LD_FLAGS =$(LD_FLAGS_COMMON) \ 14 -X code.cloudfoundry.org/cli/version.binaryVersion=$(CF_BUILD_VERSION) 15 LD_FLAGS_V7 =$(LD_FLAGS_COMMON) \ 16 -X code.cloudfoundry.org/cli/version.binaryVersion=$(CF_BUILD_VERSION_V7) 17 LD_FLAGS_LINUX = -extldflags \"-static\" $(LD_FLAGS) 18 LD_FLAGS_LINUX_V7 = -extldflags \"-static\" $(LD_FLAGS_V7) 19 REQUIRED_FOR_STATIC_BINARY =-a -tags netgo -installsuffix netgo 20 REQUIRED_FOR_STATIC_BINARY_V7 =-a -tags "V7 netgo" -installsuffix netgo 21 GOSRC = $(shell find . -name "*.go" ! -name "*test.go" ! -name "*fake*" ! -path "./integration/*") 22 UNAME_S := $(shell uname -s) 23 24 25 ifndef TARGET_V7 26 TARGET = v6 27 export GOFLAGS = 28 ginkgo_int = ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 29 else 30 TARGET = v7 31 export GOFLAGS = -tags=V7 32 ginkgo_int = ginkgo -r -randomizeAllSpecs -slowSpecThreshold 120 33 endif 34 35 all: lint test build 36 37 build: out/cf ## Compile and build a new `cf` binary 38 39 check-target-env: 40 ifndef CF_INT_API 41 $(error CF_INT_API is undefined) 42 endif 43 ifndef CF_INT_PASSWORD 44 $(error CF_INT_PASSWORD is undefined) 45 endif 46 47 clean: ## Just remove all cf* files from the `out` directory 48 rm -f $(wildcard out/cf*) 49 50 clear: clean ## Make everyone happy 51 52 custom-lint: ## Run our custom linters 53 @echo "style linting files:" # this list will grow as we cleanup all the code 54 @bash -c "go run bin/style/main.go api util" 55 @echo "No lint errors!" 56 @echo 57 58 fly-windows-experimental: check-target-env 59 CF_TEST_SUITE=./integration/shared/experimental fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./ --tag "cli-windows" 60 61 fly-windows-isolated: check-target-env 62 CF_TEST_SUITE=./integration/shared/isolated fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./ --tag "cli-windows" 63 64 fly-windows-plugin: check-target-env 65 CF_TEST_SUITE=./integration/$(TARGET)/plugin fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./ --tag "cli-windows" 66 67 fly-windows-push: check-target-env 68 CF_TEST_SUITE=./integration/v6/push fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./ --tag "cli-windows" 69 70 fly-windows-global: check-target-env 71 CF_TEST_SUITE=./integration/shared/global fly -t ci execute -c ci/cli/tasks/integration-windows-serial.yml -i cli=./ --tag "cli-windows" 72 73 fly-windows-units: 74 fly -t ci execute -c ci/cli/tasks/units-windows.yml -i cli=./ -i cli-ci=./ --tag "cli-windows" 75 76 format: ## Run go fmt 77 go fmt ./... 78 79 golangci-lint: ## Run golangci-lint to validate code quality 80 golangci-lint run 81 82 golangci-lint-fix: ## Run golangci-lint --fix to try to autofix issues 83 golangci-lint run --fix 84 85 integration-cleanup: 86 $(PWD)/bin/cleanup-integration 87 88 ie: integration-experimental 89 integration-experimental: build integration-cleanup integration-shared-experimental integration-experimental-versioned ## Run all experimental integration tests, both versioned and shared across versions 90 91 ise: integration-shared-experimental 92 integration-experimental-shared: integration-shared-experimental 93 integration-shared-experimental: build integration-cleanup ## Run experimental integration tests that are shared between v6 and v7 94 $(ginkgo_int) -nodes $(NODES) integration/shared/experimental 95 96 ive: integration-versioned-experimental 97 integration-experimental-versioned: integration-versioned-experimental 98 integration-versioned-experimental: build integration-cleanup ## Run experimental integration tests that are specific to your CLI version 99 $(ginkgo_int) -nodes $(NODES) integration/$(TARGET)/experimental 100 101 ig: integration-global 102 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 103 104 isg: integration-shared-global 105 integration-global-shared: integration-shared-global 106 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 107 $(ginkgo_int) integration/shared/global 108 109 ivg: integration-versioned-global 110 integration-global-versioned: integration-versioned-global 111 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 112 $(ginkgo_int) integration/$(TARGET)/global 113 114 ii: integration-isolated 115 integration-isolated: build integration-cleanup integration-shared-isolated integration-isolated-versioned ## Run all parallel-enabled integration tests, both versioned and shared across versions 116 117 isi: integration-shared-isolated 118 integration-isolated-shared: integration-shared-isolated 119 integration-shared-isolated: build integration-cleanup ## Run all parallel-enabled integration tests that are shared between v6 and v7 120 $(ginkgo_int) -nodes $(NODES) integration/shared/isolated 121 122 integration-performance: build integration-cleanup integration-shared-performance 123 124 isp: integration-shared-performance 125 integration-performance-shared: integration-shared-performance 126 integration-shared-performance: build integration-cleanup 127 $(ginkgo_int) integration/shared/performance 128 129 ivi: integration-versioned-isolated 130 integration-isolated-versioned: integration-versioned-isolated 131 integration-versioned-isolated: build integration-cleanup ## Run all parallel-enabled integration tests, both versioned and shared across versions 132 $(ginkgo_int) -nodes $(NODES) integration/$(TARGET)/isolated 133 134 integration-plugin: build integration-cleanup ## Run all plugin-related integration tests 135 $(ginkgo_int) -nodes $(NODES) integration/$(TARGET)/plugin 136 137 ip: integration-push 138 integration-push: build integration-cleanup ## Run all push-related integration tests 139 $(ginkgo_int) -nodes $(NODES) integration/$(TARGET)/push 140 141 integration-tests: build integration-cleanup integration-isolated integration-push integration-global ## Run all isolated, push, and global integration tests 142 143 i: integration-tests-full 144 integration-full-tests: integration-tests-full 145 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 146 147 lint: format custom-lint golangci-lint ## Runs all linters and formatters 148 149 ifeq ($(TARGET),v6) 150 out/cf: out/cf6 151 cp out/cf6 out/cf 152 else 153 out/cf: out/cf7 154 cp out/cf7 out/cf 155 endif 156 157 # Build dynamic binary for Darwin 158 ifeq ($(UNAME_S),Darwin) 159 out/cf6: $(GOSRC) 160 go build -ldflags "$(LD_FLAGS)" -o out/cf6 . 161 else 162 out/cf6: $(GOSRC) 163 CGO_ENABLED=0 go build \ 164 $(REQUIRED_FOR_STATIC_BINARY) \ 165 -ldflags "$(LD_FLAGS_LINUX)" -o out/cf6 . 166 endif 167 168 # Build dynamic binary for Darwin 169 ifeq ($(UNAME_S),Darwin) 170 out/cf7: $(GOSRC) 171 go build -tags="V7" -ldflags "$(LD_FLAGS_V7)" -o out/cf7 . 172 else 173 out/cf7: $(GOSRC) 174 CGO_ENABLED=0 go build \ 175 $(REQUIRED_FOR_STATIC_BINARY_V7) \ 176 -ldflags "$(LD_FLAGS_LINUX_V7)" -o out/cf7 . 177 endif 178 179 out/cf-cli_linux_i686: $(GOSRC) 180 CGO_ENABLED=0 GOARCH=386 GOOS=linux go build \ 181 $(REQUIRED_FOR_STATIC_BINARY) \ 182 -ldflags "$(LD_FLAGS_LINUX)" -o out/cf-cli_linux_i686 . 183 184 out/cf-cli_linux_x86-64: $(GOSRC) 185 CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build \ 186 $(REQUIRED_FOR_STATIC_BINARY) \ 187 -ldflags "$(LD_FLAGS_LINUX)" -o out/cf-cli_linux_x86-64 . 188 189 out/cf-cli_osx: $(GOSRC) 190 GOARCH=amd64 GOOS=darwin go build \ 191 -a -ldflags "$(LD_FLAGS)" -o out/cf-cli_osx . 192 193 out/cf-cli_win32.exe: $(GOSRC) rsrc.syso 194 GOARCH=386 GOOS=windows go build -tags="forceposix" -o out/cf-cli_win32.exe -ldflags "$(LD_FLAGS)" . 195 rm rsrc.syso 196 197 out/cf-cli_winx64.exe: $(GOSRC) rsrc.syso 198 GOARCH=amd64 GOOS=windows go build -tags="forceposix" -o out/cf-cli_winx64.exe -ldflags "$(LD_FLAGS)" . 199 rm rsrc.syso 200 201 out/cf7-cli_linux_i686: $(GOSRC) 202 CGO_ENABLED=0 GOARCH=386 GOOS=linux go build \ 203 $(REQUIRED_FOR_STATIC_BINARY_V7) \ 204 -ldflags "$(LD_FLAGS_LINUX_V7)" -o out/cf7-cli_linux_i686 . 205 206 out/cf7-cli_linux_x86-64: $(GOSRC) 207 CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build \ 208 $(REQUIRED_FOR_STATIC_BINARY_V7) \ 209 -ldflags "$(LD_FLAGS_LINUX_V7)" -o out/cf7-cli_linux_x86-64 . 210 211 out/cf7-cli_osx: $(GOSRC) 212 GOARCH=amd64 GOOS=darwin go build -tags="V7" \ 213 -a -ldflags "$(LD_FLAGS_V7)" -o out/cf7-cli_osx . 214 215 out/cf7-cli_win32.exe: $(GOSRC) rsrc.syso 216 GOARCH=386 GOOS=windows go build -tags="forceposix V7" -o out/cf7-cli_win32.exe -ldflags "$(LD_FLAGS_V7)" . 217 rm rsrc.syso 218 219 out/cf7-cli_winx64.exe: $(GOSRC) rsrc.syso 220 GOARCH=amd64 GOOS=windows go build -tags="forceposix V7" -o out/cf7-cli_winx64.exe -ldflags "$(LD_FLAGS_V7)" . 221 rm rsrc.syso 222 223 rsrc.syso: 224 @# Software for windows icon 225 go get github.com/akavel/rsrc 226 @# Generates icon file 227 rsrc -ico ci/installers/windows/cf.ico 228 229 test: units ## (synonym for units) 230 231 units: units-full ## (synonym for units-full) 232 233 units-plugin: 234 ifeq ($(TARGET),v6) 235 CF_HOME=$(PWD)/fixtures ginkgo -r -nodes 1 -randomizeAllSpecs -randomizeSuites -flakeAttempts 2 -skipPackage integration,v7 ./**/plugin* ./plugin 236 else 237 CF_HOME=$(PWD)/fixtures ginkgo -r -nodes 1 -randomizeAllSpecs -randomizeSuites -flakeAttempts 2 -skipPackage integration ./**/plugin* ./plugin 238 endif 239 240 units-non-plugin: 241 @rm -f $(wildcard fixtures/plugins/*.exe) 242 @ginkgo version 243 CF_HOME=$(PWD)/fixtures CF_USERNAME="" CF_PASSWORD="" ginkgo -r -p -randomizeAllSpecs -randomizeSuites \ 244 -skipPackage integration,cf/ssh,plugin,cf/actors/plugin,cf/commands/plugin,cf/actors/plugin 245 CF_HOME=$(PWD)/fixtures ginkgo -r -p -randomizeAllSpecs -randomizeSuites -flakeAttempts 3 cf/ssh 246 247 units-full: build units-plugin units-non-plugin 248 @echo "\nSWEET SUITE SUCCESS" 249 250 version: ## Print the version number of what would be built 251 @echo $(CF_BUILD_VERSION)+$(CF_BUILD_SHA).$(CF_BUILD_DATE) 252 253 .PHONY: all build clean format version lint custom-lint golangci-lint golangci-lint-fix 254 .PHONY: test units units-full integration integration-tests-full integration-cleanup integration-experimental integration-plugin integration-isolated integration-push 255 .PHONY: check-target-env fly-windows-experimental fly-windows-isolated fly-windows-plugin fly-windows-push 256 .PHONY: help 257 258 help: 259 @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-34s\033[0m %s\n", $$1, $$2}'