-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
80 lines (52 loc) · 1.83 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
SHELL = /bin/bash
GO-VER = go1.19
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;)
# #### 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-goimports: deps-go-binary
ifndef HAS_GO_IMPORTS
go install golang.org/x/tools/cmd/goimports@latest
endif
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/marman/version.Version=$(VERSION)"
build/marman: $(SRC) deps
go build -o build/marman -ldflags ${LDFLAGS} ./cmd/marman/main.go
build: build/marman
build-all: build-linux build-darwin
build-linux: build/marman-linux
build/marman-linux: $(SRC) deps
GOARCH=amd64 GOOS=linux go build -o build/marman-linux -ldflags ${LDFLAGS} ./cmd/marman/main.go
build-darwin: build/marman-darwin
build/marman-darwin: $(SRC) deps
GOARCH=amd64 GOOS=darwin go build -o build/marman-darwin -ldflags ${LDFLAGS} ./cmd/marman/main.go
build-image: build/marman-linux
docker build --tag cfplatformeng/marman:${VERSION} --file Dockerfile .
# #### TESTS ####
test-units: deps lint
ginkgo -r -skipPackage features .
test-features: deps
ginkgo -r -tags=feature features
test: test-units test-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 marman -c ci/pipeline.yaml