-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
75 lines (69 loc) · 2.16 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
# Copyright Aeraki Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Go parameters
GOCMD?=go
GOBUILD?=$(GOCMD) build
GOTEST?=$(GOCMD) test
GOCLEAN?=$(GOCMD) clean
GOTEST?=$(GOCMD) test
GOGET?=$(GOCMD) get
GOBIN?=$(GOPATH)/bin
GOMOD?=$(GOCMD) mod
# Build parameters
IMAGE_TAG := $(tag)
ifeq ($(IMAGE_TAG),)
IMAGE_TAG := latest
endif
OUT?=./out
DOCKER_TMP?=$(OUT)/docker_temp/
# lazyxds
LAZYXDS_DOCKER_TAG?=aeraki/lazyxds:$(IMAGE_TAG)
LAZYXDS_DOCKER_TAG_E2E?=aeraki/lazyxds:`git log --format="%H" -n 1`
LAZYXDS_BINARY_NAME?=$(OUT)/lazyxds
LAZYXDS_BINARY_NAME_DARWIN?=$(LAZYXDS_BINARY_NAME)-darwin
LAZYXDS_MAIN?=./cmd/lazyxds/main.go
test: style-check
$(GOMOD) tidy
$(GOTEST) -race `go list ./... | grep -v e2e`
clean:
rm -rf $(OUT)
style-check:
gofmt -l -d ./
goimports -l -d ./
lint:
golint ./...
golangci-lint run --tests="false"
build.lazyxds: test
CGO_ENABLED=0 GOOS=linux $(GOBUILD) -o $(LAZYXDS_BINARY_NAME) $(LAZYXDS_MAIN)
build-mac.lazyxds: test
CGO_ENABLED=0 GOOS=darwin $(GOBUILD) -o $(LAZYXDS_BINARY_NAME_DARWIN) $(LAZYXDS_MAIN)
docker-build.lazyxds: build.lazyxds
rm -rf $(DOCKER_TMP)
mkdir $(DOCKER_TMP)
cp ./lazyxds/docker/Dockerfile $(DOCKER_TMP)
cp $(LAZYXDS_BINARY_NAME) $(DOCKER_TMP)
docker build -t $(LAZYXDS_DOCKER_TAG) $(DOCKER_TMP)
rm -rf $(DOCKER_TMP)
docker-push.lazyxds: docker-build.lazyxds
docker push $(LAZYXDS_DOCKER_TAG)
docker-build-e2e.lazyxds: build.lazyxds
rm -rf $(DOCKER_TMP)
mkdir $(DOCKER_TMP)
cp ./lazyxds/docker/Dockerfile $(DOCKER_TMP)
cp $(LAZYXDS_BINARY_NAME) $(DOCKER_TMP)
docker build -t $(LAZYXDS_DOCKER_TAG_E2E) $(DOCKER_TMP)
rm -rf $(DOCKER_TMP)
e2e-lazyxds:
ginkgo -v ./test/e2e/lazyxds/lazyxds/
.DEFAULT_GOAL := docker-build