-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
82 lines (52 loc) · 1.84 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
SHELL = /bin/bash
GO-VER = go1.23
default: build
# #### GO Binary Management ####
deps-go-binary:
echo "Expect: $(GO-VER)" && \
echo "Actual: $$(go version)" && \
go version | grep $(GO-VER) > /dev/null
HAS_GO_IMPORTS := $(shell command -v goimports;)
deps-goimports: deps-go-binary
ifndef HAS_GO_IMPORTS
go get -u golang.org/x/tools/cmd/goimports
endif
# #### CLEAN ####
clean: deps-go-binary
rm -rf build/*
go clean --modcache
# #### DEPS ####
deps-modules: deps-goimports deps-go-binary
go mod download
deps-counterfeiter: deps-modules
go install github.com/maxbrunsfeld/counterfeiter/v6@latest
deps-ginkgo: deps-go-binary
go install github.com/onsi/ginkgo/ginkgo@latest
deps: deps-modules deps-counterfeiter deps-ginkgo
# #### BUILD ####
SRC = $(shell find . -name "*.go" | grep -v "_test\." )
VERSION := $(or $(VERSION), "dev")
LDFLAGS="-X github.com/cf-platform-eng/mrlog/version.Version=$(VERSION)"
build/mrlog: $(SRC)
go build -o build/mrlog -ldflags ${LDFLAGS} ./cmd/mrlog/main.go
build: deps build/mrlog
build/mrlog-linux: $(SRC)
GOARCH=amd64 GOOS=linux go build -o build/mrlog-linux -ldflags ${LDFLAGS} ./cmd/mrlog/main.go
build-linux: deps build/mrlog-linux
build/mrlog-darwin: $(SRC) $(GENERATE_ARTIFACTS)
GOARCH=amd64 GOOS=darwin go build -o build/mrlog-darwin -ldflags ${LDFLAGS} ./cmd/mrlog/main.go
build-darwin: deps build/mrlog-darwin
build-all: build-linux build-darwin
build-image: build/mrlog-linux
docker build --tag cfplatformeng/mrlog:${VERSION} --file Dockerfile .
# #### TESTS ####
units: deps
ginkgo -r -skipPackage features .
features: deps $(GENERATE_ARTIFACTS)
ginkgo -r -tags=feature features
test: deps lint units features
lint: deps-goimports
git ls-files | grep '.go$$' | xargs goimports -l -w
.PHONY: set-pipeline
set-pipeline: ci/pipeline.yaml
fly -t ppe-isv set-pipeline -p mrlog -c ci/pipeline.yaml