-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (36 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
DOCKER_REGISTRY=radixdev.azurecr.io
VERSION=latest
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
IMAGE_NAME=$(DOCKER_REGISTRY)/radix-vulnerability-scanner:$(BRANCH)-$(VERSION)
.PHONY: build
build:
docker build -t $(IMAGE_NAME) .
.PHONY: push
push: build
az acr login -n $(DOCKER_REGISTRY)
docker push $(IMAGE_NAME)
.PHONY: pushmultiplatform
pushmultiplatform:
az acr login -n $(DOCKER_REGISTRY)
docker buildx build --platform=linux/amd64,linux/arm64 -t $(IMAGE_NAME) --push .
.PHONY: test
test:
go test -cover `go list ./... | grep -v 'pkg/client'`
.PHONY: lint
lint: bootstrap
golangci-lint run --max-same-issues 0
.PHONY: mocks
mocks: bootstrap
mockgen -source ./pkg/db/repository.go -destination ./pkg/db/mock/repository.go -package mock
mockgen -source ./pkg/scan/scanner.go -destination ./pkg/scan/mock/scanner.go -package mock
mockgen -source ./pkg/scan/executor/executor.go -destination ./pkg/scan/executor/mock/executor.go -package mock
mockgen -source ./pkg/registry/auth.go -destination ./pkg/registry/mock/auth.go -package mock
HAS_GOLANGCI_LINT := $(shell command -v golangci-lint;)
HAS_MOCKGEN := $(shell command -v mockgen;)
bootstrap:
ifndef HAS_GOLANGCI_LINT
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
endif
ifndef HAS_MOCKGEN
go install github.com/golang/mock/[email protected]
endif