forked from dell/csi-unity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
114 lines (93 loc) · 3.34 KB
/
Makefile
File metadata and controls
114 lines (93 loc) · 3.34 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
NAME:=csi-unity
.PHONY: all
all: go-build
ifneq (on,$(GO111MODULE))
export GO111MODULE := on
endif
IMAGE_NAME=csi-unity
IMAGE_REGISTRY=dellemc
DEFAULT_IMAGE_TAG=$(shell date +%Y%m%d%H%M%S)
ifeq ($(IMAGETAG),)
export IMAGETAG="$(DEFAULT_IMAGE_TAG)"
endif
.PHONY: go-vendor
go-vendor:
go mod vendor
.PHONY: go-build
go-build: clean
git config core.hooksPath hooks
rm -f core/core_generated.go
cd core && go generate
go build .
UNIT_TESTED_PACKAGES := \
github.com/dell/csi-unity \
github.com/dell/csi-unity/k8sutils \
github.com/dell/csi-unity/provider \
github.com/dell/csi-unity/service \
github.com/dell/csi-unity/service/csiutils \
github.com/dell/csi-unity/service/logging
unit-test:
go clean -cache
@for pkg in $(UNIT_TESTED_PACKAGES); do \
echo "****** go test -v -short -race -count=1 -cover -coverprofile cover.out $$pkg ******"; \
go test -v -short -race -count=1 -cover -coverprofile cover.out $$pkg; \
done
# Integration tests using Godog. Populate env.sh with the hardware parameters
integration-test:
( cd test/integration-test; sh run.sh )
# BDD tests using Godog. Populate env.sh with the hardware parameters
bdd-test:
( cd test/bdd-test; sh run.sh )
.PHONY: download-csm-common
download-csm-common:
curl -O -L https://raw.githubusercontent.com/dell/csm/main/config/csm-common.mk
#
# Docker-related tasks
#
# Generates the docker container (but does not push)
podman-build: download-csm-common go-build
$(eval include csm-common.mk)
podman build --pull -t $(IMAGE_REGISTRY)/$(IMAGE_NAME):$(IMAGETAG) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) --build-arg BASEIMAGE=$(CSM_BASEIMAGE) --build-arg GOPROXY=$(GOPROXY) . --format=docker
podman-build-no-cache: download-csm-common go-build
$(eval include csm-common.mk)
podman build --pull --no-cache -t $(IMAGE_REGISTRY)/$(IMAGE_NAME):$(IMAGETAG) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) --build-arg BASEIMAGE=$(CSM_BASEIMAGE) --build-arg GOPROXY=$(GOPROXY) . --format=docker
podman-push:
podman push $(IMAGE_REGISTRY)/$(IMAGE_NAME):$(IMAGETAG)
#
# Docker-related tasks
#
# Generates the docker container (but does not push)
docker-build: download-csm-common
make -f docker.mk docker-build
docker-push:
make -f docker.mk docker-push
version:
go generate
go run core/semver/semver.go -f mk >semver.mk
make -f docker.mk version
.PHONY: clean
clean:
rm -f core/core_generated.go
go clean
#
# Tests-related tasks
.PHONY: integ-test
integ-test: go-build
go test -v ./test/...
check:
sh scripts/check.sh
.PHONY: actions action-help
actions: ## Run all GitHub Action checks that run on a pull request creation
@echo "Running all GitHub Action checks for pull request events..."
@act -l | grep -v ^Stage | grep pull_request | grep -v image_security_scan | awk '{print $$2}' | while read WF; do \
echo "Running workflow: $${WF}"; \
act pull_request --no-cache-server --platform ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest --job "$${WF}"; \
done
action-help: ## Echo instructions to run one specific workflow locally
@echo "GitHub Workflows can be run locally with the following command:"
@echo "act pull_request --no-cache-server --platform ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest --job <jobid>"
@echo ""
@echo "Where '<jobid>' is a Job ID returned by the command:"
@echo "act -l"
@echo ""
@echo "NOTE: if act is not installed, it can be downloaded from https://github.com/nektos/act"