github.com/nimakaviani/cli@v6.37.1-0.20180619223813-e734901a73fa+incompatible/Makefile (about)

     1  CF_DIAL_TIMEOUT ?= 15
     2  NODES ?= 4
     3  LC_ALL = "en_US.UTF-8"
     4  
     5  CF_BUILD_VERSION ?= $$(cat BUILD_VERSION)
     6  CF_BUILD_SHA ?= $$(git rev-parse --short HEAD)
     7  CF_BUILD_DATE ?= $$(date -u +"%Y-%m-%d")
     8  LD_FLAGS =-w -s \
     9  	-X code.cloudfoundry.org/cli/version.binaryVersion=$(CF_BUILD_VERSION) \
    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_LINUX = -extldflags \"-static\" $(LD_FLAGS)
    13  REQUIRED_FOR_STATIC_BINARY =-a -tags netgo -installsuffix netgo
    14  GOSRC = $(shell find . -name "*.go" ! -name "*test.go" ! -name "*fake*" ! -path "./integration/*")
    15  
    16  all : test build
    17  
    18  build : out/cf-cli_linux_x86-64
    19  	cp out/cf-cli_linux_x86-64 out/cf
    20  
    21  osx: out/cf-cli_osx
    22  	cp out/cf-cli_osx out/cf
    23  
    24  check-target-env :
    25  ifndef CF_INT_API
    26  	$(error CF_INT_API is undefined)
    27  endif
    28  ifndef CF_INT_PASSWORD
    29  	$(error CF_INT_PASSWORD is undefined)
    30  endif
    31  
    32  clean :
    33  	rm -f $(wildcard out/cf*)
    34  
    35  format :
    36  	go fmt ./...
    37  
    38  fly-windows-experimental : check-target-env
    39  	CF_TEST_SUITE=./integration/experimental fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    40  
    41  fly-windows-isolated : check-target-env
    42  	CF_TEST_SUITE=./integration/isolated fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    43  
    44  fly-windows-plugin : check-target-env
    45  	CF_TEST_SUITE=./integration/plugin fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    46  
    47  fly-windows-push : check-target-env
    48  	CF_TEST_SUITE=./integration/push fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    49  
    50  fly-windows-global : check-target-env
    51  	CF_TEST_SUITE=./integration/global fly -t ci execute -c ci/cli/tasks/integration-windows-serial.yml -i cli=./
    52  
    53  fly-windows-units :
    54  	fly -t ci execute -c ci/cli/tasks/units-windows.yml -i cli=./ -i cli-ci=./
    55  
    56  integration-cleanup :
    57  	$(PWD)/bin/cleanup-integration
    58  
    59  integration-experimental : build integration-cleanup
    60  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) integration/experimental
    61  
    62  integration-global : build integration-cleanup
    63  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 integration/global
    64  
    65  integration-isolated : build integration-cleanup
    66  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) integration/isolated
    67  
    68  integration-plugin : build integration-cleanup
    69  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) integration/plugin
    70  
    71  integration-push : build integration-cleanup
    72  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) integration/push
    73  
    74  integration-tests : build integration-cleanup
    75  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) integration/isolated integration/push
    76  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 integration/global
    77  	make integration-cleanup
    78  
    79  integration-tests-full : build integration-cleanup
    80  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) \
    81  		integration/isolated integration/push integration/plugin integration/experimental
    82  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 integration/global
    83  	make integration-cleanup
    84  
    85  lint :
    86  	@echo "style linting files:" # this list will grow as we cleanup all the code
    87  	@bash -c "go run bin/style/main.go api util/{configv3,manifest,randomword,sorting,ui}"
    88  	@echo "No lint errors!"
    89  	@echo
    90  
    91  out/cf-cli_linux_i686 : $(GOSRC)
    92  	CGO_ENABLED=0 GOARCH=386 GOOS=linux go build \
    93  							$(REQUIRED_FOR_STATIC_BINARY) \
    94  							-ldflags "$(LD_FLAGS_LINUX)" -o out/cf-cli_linux_i686 .
    95  
    96  out/cf-cli_linux_x86-64 : $(GOSRC)
    97  	CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build \
    98  							$(REQUIRED_FOR_STATIC_BINARY) \
    99  							-ldflags "$(LD_FLAGS_LINUX)" -o out/cf-cli_linux_x86-64 .
   100  
   101  out/cf-cli_osx : $(GOSRC)
   102  	GOARCH=amd64 GOOS=darwin go build \
   103  				 $(REQUIRED_FOR_STATIC_BINARY) \
   104  				 -ldflags "$(LD_FLAGS)" -o out/cf-cli_osx .
   105  
   106  out/cf-cli_win32.exe : $(GOSRC) rsrc.syso
   107  	GOARCH=386 GOOS=windows go build -tags="forceposix" -o out/cf-cli_win32.exe -ldflags "$(LD_FLAGS)" .
   108  	rm rsrc.syso
   109  
   110  out/cf-cli_winx64.exe : $(GOSRC) rsrc.syso
   111  	GOARCH=amd64 GOOS=windows go build -tags="forceposix" -o out/cf-cli_winx64.exe -ldflags "$(LD_FLAGS)" .
   112  	rm rsrc.syso
   113  
   114  rsrc.syso :
   115  	@# Software for windows icon
   116  	go get github.com/akavel/rsrc
   117  	@# Generates icon file
   118  	rsrc -ico ci/installers/windows/cf.ico
   119  
   120  test : units
   121  
   122  units : format vet lint build
   123  	ginkgo -r -nodes $(NODES) -randomizeAllSpecs -randomizeSuites \
   124  		api actor command types util version
   125  	@echo "\nSWEET SUITE SUCCESS"
   126  
   127  units-full : format vet lint build
   128  	@rm -f $(wildcard fixtures/plugins/*.exe)
   129  	@ginkgo version
   130  	CF_HOME=$(PWD)/fixtures ginkgo -r -nodes $(NODES) -randomizeAllSpecs -randomizeSuites -skipPackage integration,cf/ssh
   131  	CF_HOME=$(PWD)/fixtures ginkgo -r -nodes $(NODES) -randomizeAllSpecs -randomizeSuites -flakeAttempts 3 cf/ssh
   132  	@echo "\nSWEET SUITE SUCCESS"
   133  
   134  version :
   135  	@echo $(CF_BUILD_VERSION)+$(CF_BUILD_SHA).$(CF_BUILD_DATE)
   136  
   137  vet :
   138  	@echo  "Vetting packages for potential issues..."
   139  	go tool vet -all -shadow=true ./api ./actor ./command ./integration ./types ./util ./version
   140  	@echo
   141  
   142  .PHONY : all build clean format version vet lint
   143  .PHONY : test units units-full integration integration-tests-full integration-cleanup integration-experimental integration-plugin integration-isolated integration-push
   144  .PHONY : check-target-env fly-windows-experimental fly-windows-isolated fly-windows-plugin fly-windows-push