github.com/kyma-project/kyma-environment-broker@v0.0.1/Makefile (about)

     1  APP_NAME = kyma-environment-broker
     2  APP_PATH = components/kyma-environment-broker
     3  APP_CLEANUP_NAME = kyma-environments-cleanup-job
     4  APP_SUBACCOUNT_CLEANUP_NAME = kyma-environment-subaccount-cleanup-job
     5  APP_SUBSCRIPTION_CLEANUP_NAME = kyma-environment-subscription-cleanup-job
     6  APP_TRIAL_CLEANUP_NAME = kyma-environment-trial-cleanup-job
     7  
     8  ENTRYPOINT = cmd/broker/
     9  BUILDPACK = eu.gcr.io/kyma-project/test-infra/buildpack-golang:v20221215-c20ffd65
    10  SCRIPTS_DIR = $(realpath $(shell pwd))/scripts
    11  DOCKER_SOCKET = /var/run/docker.sock
    12  TESTING_DB_NETWORK = test_network
    13  
    14  include $(SCRIPTS_DIR)/generic_make_go.mk
    15  
    16  .DEFAULT_GOAL := custom-verify
    17  
    18  custom-verify: testing-with-database-network mod-verify go-mod-check check-fmt
    19  
    20  verify:: custom-verify
    21  
    22  resolve-local:
    23  	GO111MODULE=on go mod vendor -v
    24  
    25  ensure-local:
    26  	@echo "Go modules present in component - omitting."
    27  
    28  dep-status:
    29  	@echo "Go modules present in component - omitting."
    30  
    31  dep-status-local:
    32  	@echo "Go modules present in component - omitting."
    33  
    34  mod-verify: mod-verify-local
    35  mod-verify-local:
    36  	GO111MODULE=on go mod verify
    37  
    38  go-mod-check: go-mod-check-local
    39  go-mod-check-local:
    40  	@echo make go-mod-check
    41  	go mod tidy
    42  	@if [ -n "$$(git status -s go.*)" ]; then \
    43  		echo -e "${RED}✗ go mod tidy modified go.mod or go.sum files${NC}"; \
    44  		git status -s go.*; \
    45  		exit 1; \
    46  	fi;
    47  
    48  # We have to override test-local and errcheck, because we need to run provisioner with database
    49  #as docker container connected with custom network and the buildpack container itsefl has to be connected to the network
    50  
    51  test-local: ;
    52  errcheck-local: ;
    53  
    54  # TODO: there is no errcheck in go1.13 buildpack, consider creating buildpack-toolbox with go1.13 version
    55  # errcheck-local:
    56  # 	@docker run $(DOCKER_INTERACTIVE) \
    57  # 		-v $(COMPONENT_DIR):$(WORKSPACE_COMPONENT_DIR):delegated \
    58  # 		$(DOCKER_CREATE_OPTS) errcheck -blank -asserts -ignorepkg '$$($(DIRS_TO_CHECK) | tr '\n' ',')' -ignoregenerated ./...
    59  
    60  test-integration-local:
    61  	go test ./... -tags=integration
    62  
    63  test-integration:
    64  	@echo make test-integration-local
    65  	@docker run $(DOCKER_INTERACTIVE) \
    66  		-v $(COMPONENT_DIR):$(WORKSPACE_COMPONENT_DIR):delegated \
    67  		$(DOCKER_CREATE_OPTS) make test-integration-local
    68  
    69  testing-with-database-network:
    70  	@docker version
    71  	@echo testing-with-database-network
    72  	@docker network inspect $(TESTING_DB_NETWORK) >/dev/null 2>&1 || \
    73  	docker network create --driver bridge $(TESTING_DB_NETWORK)
    74  	@docker run $(DOCKER_INTERACTIVE) \
    75  		-v $(DOCKER_SOCKET):$(DOCKER_SOCKET) \
    76  		-v $(COMPONENT_DIR)/../../:$(WORKSPACE_COMPONENT_DIR)/../../ \
    77  		--network=$(TESTING_DB_NETWORK) \
    78  		-v $(COMPONENT_DIR):$(WORKSPACE_COMPONENT_DIR):delegated \
    79  		--env PIPELINE_BUILD=1 --env GO111MODULE=on \
    80  		$(DOCKER_CREATE_OPTS) go test -tags=database_integration ./...
    81  	@docker network rm $(TESTING_DB_NETWORK) || true
    82  
    83  clean-up:
    84  	@docker network rm $(TESTING_DB_NETWORK) || true
    85  
    86  .PHONY: test
    87  test:
    88  	go test ./...