-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
73 lines (60 loc) · 2.21 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
.PHONY: all
all: help
help:
@echo
@echo "The following targets are commonly used:"
@echo
@echo "build - Builds the code locally"
@echo "clean - Cleans the local build"
@echo "podman - Builds Podman image"
@echo "tag - Tags Podman image"
@echo "push - Pushes Podman image to a registry"
@echo "check - Runs code checking tools: lint, format, gosec, and vet"
@echo "test - Runs the unit tests"
@echo
.PHONY: build
build: generate
CGO_ENABLED=0 GOOS=linux go build -o ./cmd/topology/bin/service ./cmd/topology
.PHONY: clean
clean:
rm -rf cmd/bin
.PHONY: generate
generate:
go generate ./...
.PHONY: test
test:
go test -count=1 -cover -race -timeout 30s -short ./...
.PHONY: podman
podman: download-csm-common
$(eval include csm-common.mk)
podman build --pull $(NOCACHE) -t csm-topology -f Dockerfile --build-arg BASEIMAGE=$(CSM_BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) .
.PHONY: podman-no-cache
podman-no-cache:
@make podman NOCACHE="--no-cache"
.PHONY: tag
tag:
podman tag csm-topology:latest ${DOCKER_REPO}/csm-topology:latest
.PHONY: push
push:
podman push ${DOCKER_REPO}/csm-topology:latest
.PHONY: check
check:
./scripts/check.sh ./cmd/... ./internal/...
.PHONY: download-csm-common
download-csm-common:
curl -O -L https://raw.githubusercontent.com/dell/csm/main/config/csm-common.mk
.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"