-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathMakefile
52 lines (39 loc) · 1.43 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
ifeq (/,${HOME})
GOLANGCI_LINT_CACHE=/tmp/golangci-lint-cache/
else
GOLANGCI_LINT_CACHE=${HOME}/.cache/golangci-lint
endif
GOLANGCI_LINT ?= GOLANGCI_LINT_CACHE=$(GOLANGCI_LINT_CACHE) go run github.com/golangci/golangci-lint/cmd/golangci-lint
# See pkg/version.go for details
SOURCE_GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
BUILD_VERSION ?= $(shell git describe --always --abbrev=40 --dirty)
VERSION_URI = "github.com/openshift/image-customization-controller/pkg/version"
export LDFLAGS="-X $(VERSION_URI).Raw=${BUILD_VERSION} \
-X $(VERSION_URI).Commit=${SOURCE_GIT_COMMIT} \
-X $(VERSION_URI).BuildTime=$(shell date +%Y-%m-%dT%H:%M:%S%z)"
IMG ?= image-customization-controller:latest
# Set VERBOSE to -v to make tests produce more output
VERBOSE ?=
all: image-customization-controller image-customization-server
test: generate lint unit
unit:
go test $(VERBOSE) ./... -coverprofile cover.out
image-customization-controller: generate
go build -ldflags $(LDFLAGS) -o bin/image-customization-controller cmd/controller/main.go
image-customization-server: generate
go build -ldflags $(LDFLAGS) -o bin/image-customization-server cmd/static-server/main.go
run:
go run ./main.go
.PHONY: lint
lint:
$(GOLANGCI_LINT) run
.PHONY: generate
generate:
# go generate -x ./...
$(GOLANGCI_LINT) run --fix
.PHONY: docker
docker: generate
docker build . -t ${IMG}
.PHONY: docker-push
docker-push:
docker push ${IMG}