-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
82 lines (62 loc) · 2.61 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
80
81
82
VERSION ?= $(shell git describe --tags --always )
TARGET ?= $(shell basename `git rev-parse --show-toplevel`)
TEST ?= $(shell go list ./... | grep -v /vendor/)
RECORD_ACCEPTANCE ?= false
REPOSITORY := mattdeboer/${TARGET}
DOCKER_IMAGE ?= ${REPOSITORY}:${VERSION}
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
REVISION ?= $(shell git rev-parse HEAD)
LD_FLAGS ?= -s -X github.com/matt-deboer/${TARGET}/pkg/version.Name=$(TARGET) \
-X github.com/matt-deboer/${TARGET}/pkg/version.Revision=$(REVISION) \
-X github.com/matt-deboer/${TARGET}/pkg/version.Branch=$(BRANCH) \
-X github.com/matt-deboer/${TARGET}/pkg/version.Version=$(VERSION)
default: test build
test:
go test -v -cover -run=$(RUN) $(TEST)
build: clean
@GO111MODULE=on go build -v -o bin/$(TARGET) -ldflags "$(LD_FLAGS)+local_changes" ./pkg/server
pkg/ui/build:
cd pkg/ui && npm run release
bin/go-bindata:
@ mkdir -p bin \
&& cd bin && wget https://bin.equinox.io/a/49t7LH1Gqh9/github-com-kevinburke-go-bindata-go-bindata-linux-amd64.tar.gz \
&& tar xvf github-com-kevinburke-go-bindata-go-bindata-linux-amd64.tar.gz
release-ui: pkg/ui/build bin/go-bindata
bin/go-bindata -o pkg/server/ui.go -prefix "pkg/ui/build" pkg/ui/build/...
release: clean release-ui
GO111MODULE=on CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build \
-a -tags netgo \
-a -installsuffix cgo \
-ldflags "$(LD_FLAGS)" \
-o bin/$(TARGET) ./pkg/server
ca-certificates.crt:
@-docker rm -f ${TARGET}_cacerts
@docker run --name ${TARGET}_cacerts debian:latest bash -c 'apt-get update && apt-get install -y ca-certificates'
@docker cp ${TARGET}_cacerts:/etc/ssl/certs/ca-certificates.crt .
@docker rm -f ${TARGET}_cacerts
docker: ca-certificates.crt release
@echo "Building ${DOCKER_IMAGE}..."
@docker build -t ${DOCKER_IMAGE} -f Dockerfile .
pkg/ui/node_modules:
cd pkg/ui && npm install
analyze-ui:
cd pkg/ui && npm run build && npm run analyze
dev-ui:
# now move to the ui dir and run dev
cd pkg/ui && npm run dev
minidev: build pkg/ui/node_modules
QUIET_UI=${QUIET_UI} hack/minikube-dev.sh
currentdev: build pkg/ui/node_modules
hack/current-context-dev.sh
acceptance:
VERBOSE=${VERBOSE} RECORD_ACCEPTANCE=${RECORD_ACCEPTANCE} KUILL_DISABLE_TLS=true hack/acceptance-tests.sh
acceptance-dev:
# make sure 'bashful' pod is deleted before tests
@ kubectl --context minikube delete po bashful -n default &>/dev/null || true
@ cd pkg/ui && CYPRESS_baseUrl=http://localhost:3000 npm run cypress:open
start-ui: | pkg/ui/node_modules
cd pkg/ui && npm start
clean-ui:
@rm -rf pkg/ui/build
clean:
@rm -rf bin/