-
Notifications
You must be signed in to change notification settings - Fork 38
/
Makefile
87 lines (69 loc) · 2.03 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
81
82
83
84
85
86
87
BUILD_DEST ?= bin/cluster-api-e2e
GO111MODULE = on
export GO111MODULE
GOFLAGS ?= -mod=vendor
export GOFLAGS
GOPROXY ?=
export GOPROXY
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
GOLANGCI_LINT = go run ${PROJECT_DIR}/vendor/github.com/golangci/golangci-lint/cmd/golangci-lint
NO_DOCKER ?= 1
ifeq ($(shell command -v podman > /dev/null 2>&1 ; echo $$? ), 0)
ENGINE=podman
else ifeq ($(shell command -v docker > /dev/null 2>&1 ; echo $$? ), 0)
ENGINE=docker
else
NO_DOCKER=1
endif
USE_DOCKER ?= 0
ifeq ($(USE_DOCKER), 1)
ENGINE=docker
endif
ifeq ($(NO_DOCKER), 1)
DOCKER_CMD =
else
DOCKER_CMD := $(ENGINE) run \
--rm \
-v "$(PWD)":/go/src/github.com/openshift/cluster-api-actuator-pkg:Z \
-w /go/src/github.com/openshift/cluster-api-actuator-pkg \
-e "GO111MODULE=$(GO111MODULE)" \
-e "GOFLAGS=$(GOFLAGS)" \
-e "GOPROXY=$(GOPROXY)" \
registry.ci.openshift.org/openshift/release:golang-1.22
IMAGE_BUILD_CMD = $(ENGINE) build
endif
.PHONY: all
all: check unit
.PHONY: check
check: lint
.PHONY: vendor
vendor:
go mod tidy
go mod vendor
go mod verify
make -C testutils vendor
.PHONY: lint
lint: ## Go lint your code
( GOLANGCI_LINT_CACHE=$(PROJECT_DIR)/.cache $(GOLANGCI_LINT) run --timeout 10m )
make -C testutils lint
.PHONY: fmt
fmt: ## Go fmt your code
$(DOCKER_CMD) hack/go-fmt.sh .
.PHONY: goimports
goimports: ## Go fmt your code
$(DOCKER_CMD) hack/goimports.sh .
.PHONY: unit
unit: ## Run unit tests
make -C testutils unit
.PHONY: build-e2e
build-e2e:
$(DOCKER_CMD) go test -c -o "$(BUILD_DEST)" github.com/openshift/cluster-api-actuator-pkg/pkg/
.PHONY: test-e2e
test-e2e: ## Run openshift specific e2e test
hack/ci-integration.sh $(GINKGO_ARGS) --label-filter='!periodic' -p
.PHONY: test-e2e-periodic
test-e2e-periodic: ## Run openshift specific periodic e2e test
hack/ci-integration.sh $(GINKGO_ARGS) --label-filter=periodic -p
.PHONY: help
help:
@grep -E '^[a-zA-Z/0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'