-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (54 loc) · 2.05 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
HAS_GINKGO := $(shell command -v ginkgo;)
HAS_GOLANGCI_LINT := $(shell command -v golangci-lint;)
HAS_COUNTERFEITER := $(shell command -v counterfeiter;)
PLATFORM := $(shell uname -s)
# #### DEPS ####
.PHONY: deps-counterfeiter deps-ginkgo deps-modules
deps-counterfeiter:
ifndef HAS_COUNTERFEITER
go install github.com/maxbrunsfeld/counterfeiter/v6@latest
endif
deps-ginkgo:
ifndef HAS_GINKGO
go install github.com/onsi/ginkgo/v2/ginkgo
endif
deps-modules:
go mod download
# #### TEST ####
.PHONY: lint test
lint: deps-modules
ifndef HAS_GOLANGCI_LINT
ifeq ($(PLATFORM), Darwin)
brew install golangci-lint
endif
ifeq ($(PLATFORM), Linux)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
endif
endif
golangci-lint run
test: deps-modules deps-ginkgo
ginkgo -r .
# #### BUILD ####
.PHONY: build build-all
SOURCES = $(shell find . -name "*.go" | grep -v "_test\." )
VERSION := $(or $(VERSION), dev)
LDFLAGS="-X github.com/petewall/eink-radiator/v2/cmd.Version=$(VERSION)"
build: build/eink-radiator
build/eink-radiator: $(SOURCES) deps-modules
go build -o $@ github.com/petewall/eink-radiator/v2
build-all: build/eink-radiator-arm6 build/eink-radiator-arm7 build/eink-radiator-darwin-amd64
build/eink-radiator-arm6: $(SOURCES) deps-modules
GOOS=linux GOARCH=arm GOARM=6 go build -o $@ -ldflags ${LDFLAGS} github.com/petewall/eink-radiator/v2
build/eink-radiator-arm7: $(SOURCES) deps-modules
GOOS=linux GOARCH=arm GOARM=7 go build -o $@ -ldflags ${LDFLAGS} github.com/petewall/eink-radiator/v2
build/eink-radiator-darwin-amd64: $(SOURCES) deps-modules
GOOS=darwin GOARCH=amd64 go build -o $@ -ldflags ${LDFLAGS} github.com/petewall/eink-radiator/v2
run: build/eink-radiator
build/eink-radiator --config test/config.yaml
# #### DEVOPS ####
ci/pipeline.yaml: ci/pipeline-template.yaml ci/data.yaml
ytt --file ci/pipeline-template.yaml --file ci/data.yaml > ci/pipeline.yaml
set-pipeline: ci/pipeline.yaml
fly --target wallhouse set-pipeline \
--pipeline eink-radiator \
--config ci/pipeline.yaml