forked from kubewarden/audit-scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (23 loc) · 851 Bytes
/
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
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
BIN_DIR := $(abspath $(ROOT_DIR)/bin)
IMG ?= audit-scanner:latest
GOLANGCI_LINT_VER := v1.54.2
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(BIN_DIR)/$(GOLANGCI_LINT_BIN)
all: build
$(GOLANGCI_LINT): ## Install golangci-lint.
GOBIN=$(BIN_DIR) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VER)
fmt: ## Run go fmt against code.
go fmt ./...
vet: ## Run go vet against code.
go vet ./...
lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT) run
.PHONY: unit-tests
unit-tests: fmt vet ## Run unit tests.
go test ./cmd/... ./internal/... -test.v -coverprofile cover.out
build: fmt vet lint ## Build audit-scanner binary.
go build -o bin/audit-scanner .
.PHONY: docker-build
docker-build: unit-tests
DOCKER_BUILDKIT=1 docker build -t ${IMG} .