forked from kyma-project/kyma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (62 loc) · 2.4 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
ENTRYPOINT := ./main.go
TAG := $(DOCKER_TAG)
APP_NAME = console-backend-service
APP_PATH = components/$(APP_NAME)
BUILDPACK = eu.gcr.io/kyma-project/test-infra/buildpack-golang-toolbox:v20190930-d28d219
SCRIPTS_DIR = $(realpath $(shell pwd)/../..)/common/makefiles
IMG_NAME := $(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(APP_NAME)
# VERIFY_IGNORE is a grep pattern to exclude files and directories from verification
VERIFY_IGNORE := /vendor\|/automock\|/testdata\|/pkg
# FILES_TO_CHECK is a command used to determine which files should be verified
FILES_TO_CHECK = find . -type f -name "*.go" | grep -v "$(VERIFY_IGNORE)"
# DIRS_TO_CHECK is a command used to determine which directories should be verified
DIRS_TO_CHECK = go list ./... | grep -v "$(VERIFY_IGNORE)"
release: build-image push-image
build-image: pull-licenses
docker build -t $(APP_NAME) .
push-image:
docker tag $(APP_NAME) $(IMG_NAME):$(TAG)
docker push $(IMG_NAME):$(TAG)
pull-licenses:
ifdef LICENSE_PULLER_PATH
bash $(LICENSE_PULLER_PATH)
else
mkdir -p licenses
endif
format: imports fmt
verify: test check-imports check-fmt
test:
mkdir -p /tmp/artifacts
go test -coverprofile=/tmp/artifacts/cover.out ./...
@echo -n "Total coverage: "
@go tool cover -func=/tmp/artifacts/cover.out | grep total | awk '{print $$3}'
check-imports:
@if [ -n "$$(goimports -l $$($(FILES_TO_CHECK)))" ]; then \
echo "✗ some files contain not propery formatted imports. To repair run make imports-local"; \
goimports -l $$($(FILES_TO_CHECK)); \
exit 1; \
fi;
check-fmt:
@if [ -n "$$(gofmt -l $$($(FILES_TO_CHECK)))" ]; then \
gofmt -l $$($(FILES_TO_CHECK)); \
echo "✗ some files contain not propery formatted imports. To repair run make imports-local"; \
exit 1; \
fi;
imports:
goimports -w -l $$($(FILES_TO_CHECK))
fmt:
go fmt $$($(DIRS_TO_CHECK))
build:
env CGO_ENABLED=0 go build -o $(APP_NAME) ./$(ENTRYPOINT)
run: export APP_KUBECONFIG_PATH=/Users/${USER}/.kube/config
run: export APP_VERBOSE=true
run: export APP_RAFTER_ADDRESS=https://storage.${KYMA_DOMAIN}
run: export APP_RAFTER_VERIFY_SSL=false
run: export APP_APPLICATION_GATEWAY_INTEGRATION_NAMESPACE=kyma-integration
run: export APP_APPLICATION_CONNECTOR_URL=http://dummy.url
run: export APP_OIDC_ISSUER_URL=https://dex.${KYMA_DOMAIN}
run: export APP_OIDC_CLIENT_ID=kyma-client
run:
./console-backend-service
watch:
CompileDaemon -build="make build" -command="make run" -graceful-kill