generated from cloudoperators/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
58 lines (44 loc) · 1.38 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
# Image URL to use all building/pushing image targets
TAG ?= $(shell git rev-parse --short HEAD)
IMG ?= ghcr.io/cloudoperators/concourse-oci-helm-chart-resource:$(TAG)
## Tool Binaries
GOIMPORTS ?= $(LOCALBIN)/goimports
GOLINT ?= $(LOCALBIN)/golangci-lint
## Tool Versions
GOLINT_VERSION ?= 1.64.5
GINKGOLINTER_VERSION ?= 0.19.1
## Location to install dependencies an GO binaries
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
.PHONY: all
all: build
##@ Build
.PHONY: build
build: build-check build-in build-out
build-%:
CGO_ENABLED=0 go build -ldflags '-s -w -extldflags "-static"' -o bin/$* ./cmd/$*/
.PHONY: docker-build
docker-build:
docker build --platform linux/amd64 -t ${IMG} .
.PHONY: docker-push
docker-push: docker-build
docker push ${IMG}
.PHONY: goimports
goimports: $(GOIMPORTS)
$(GOIMPORTS): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install golang.org/x/tools/cmd/goimports@latest
.PHONY: fmt
fmt: goimports
GOBIN=$(LOCALBIN) go fmt ./...
$(GOIMPORTS) -w -local github.com/cloudoperators/concourse-oci-helm-chart-resource .
.PHONY: lint
lint: golint
$(GOLINT) run -v --timeout 5m
.PHONY: check
check: fmt lint
.PHONY: golint
golint: $(GOLINT)
$(GOLINT): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$(GOLINT_VERSION)
GOBIN=$(LOCALBIN) go install github.com/nunnatsa/ginkgolinter/cmd/ginkgolinter@v$(GINKGOLINTER_VERSION)