-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
65 lines (53 loc) · 1.6 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
build:
@ echo ▶️ go build
go build
@ echo ✅ go build
@ echo ./copilot-ops -h "# run me!"
.PHONY: build
image:
docker build -t quay.io/copilot-ops/copilot-ops .
@ echo ✅ docker build
.PHONY: image
publish: image
docker push quay.io/copilot-ops/copilot-ops
@ echo ✅ docker push
.PHONY: publish
##@ Development
.PHONY: lint
lint: golangci-lint ## Lint source code
@ echo "▶️ golangci-lint run"
$(GOLANGCILINT) run ./...
@ echo "✅ golangci-lint run"
.PHONY: test
test: lint ginkgo ## Run tests.
@ echo "▶️ ginkgo test"
$(GINKGO) --coverprofile "cover.out" ./...
@ echo "✅ ginkgo test"
##@ Build Dependencies
## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
##@ Download utilities
# for performing lints
.PHONY: golangci-lint
GOLANGCILINT := $(LOCALBIN)/golangci-lint
GOLANGCI_URL := https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
golangci-lint: $(GOLANGCILINT) ## Download golangci-lint
$(GOLANGCILINT): $(LOCALBIN)
@ echo "▶️ Downloading golangci-lint"
curl -sSfL $(GOLANGCI_URL) | sh -s -- -b $(LOCALBIN) $(GOLANGCI_VERSION)
@ echo "✅ Downloading golangci-lint"
.PHONY: ginkgo
GINKGO := $(LOCALBIN)/ginkgo
ginkgo: $(GINKGO) ## Download ginkgo
$(GINKGO): $(LOCALBIN)
@ echo "▶️ Downloading ginkgo@v2"
GOBIN=$(LOCALBIN) go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
@ echo "✅ Downloaded ginkgo"
##@ Build Dependencies
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
@ echo "▶️ Local binary directory not present, creating..."
mkdir -p $(LOCALBIN)
@ echo "✅ Local binary directory created"