generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
63 lines (47 loc) · 1.58 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
#
# OCI Secrets Store CSI Driver Provider
#
# Copyright (c) 2022 Oracle America, Inc. and its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
#
$(eval BUILD_DATE=$(shell date -u +%Y.%m.%d.%H.%M))
$(eval GIT_TAG=$(shell git log -n 1 --pretty=format:"%H"))
BUILD_VERSION=$(GIT_TAG)-$(BUILD_DATE)
IMAGE_REPO_NAME=oci-secrets-store-csi-driver-provider
ifeq "$(IMAGE_REGISTRY)" ""
IMAGE_REGISTRY ?= ghcr.io/oracle-samples
else
IMAGE_REGISTRY ?= ${IMAGE_REGISTRY}
endif
# IMAGE_REPO=$(IMAGE_REGISTRY)/oci-secrets-store-csi-driver-provider
IMAGE_URL=$(IMAGE_REGISTRY)/$(IMAGE_REPO_NAME)
IMAGE_TAG=$(GIT_TAG)
IMAGE_PATH=$(IMAGE_URL):$(IMAGE_TAG)
LDFLAGS?="-X github.com/oracle-samples/oci-secrets-store-csi-driver-provider/internal/server.BuildVersion=$(BUILD_VERSION)"
.PHONY : lint test build
all: lint test build
lint:
golangci-lint run
vet:
go vet ./...
staticcheck:
# install if doesn't exist `go install honnef.co/go/tools/cmd/staticcheck@latest`
staticcheck ./...
# static code analysis
sca: lint vet staticcheck
test:
go test ./...
build: cmd/server/main.go
go build -ldflags $(LDFLAGS) -mod vendor -o dist/provider ./cmd/server/main.go
docker-build:
docker build -t ${IMAGE_PATH} -f build/Dockerfile .
# docker buildx build --platform=linux/amd64 -t ${IMAGE_PATH} -f build/Dockerfile .
docker-push:
docker push ${IMAGE_PATH}
docker-build-push: docker-build
docker push ${IMAGE_PATH}
print-docker-image-path:
@echo ${IMAGE_PATH}
test-coverage:
go test -coverprofile=cover.out ./…
go tool cover -html=cover.out