forked from edgexfoundry/app-service-configurable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
43 lines (33 loc) · 1.47 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
.PHONY: build test clean docker
GO=CGO_ENABLED=1 go
# VERSION file is not needed for local development, In the CI/CD pipeline, a temporary VERSION file is written
# if you need a specific version, just override below
APPVERSION=$(shell cat ./VERSION 2>/dev/null || echo 0.0.0)
# This pulls the version of the SDK from the go.mod file. If the SDK is the only required module,
# it must first remove the word 'required' so the offset of $2 is the same if there are multiple required modules
SDKVERSION=$(shell cat ./go.mod | grep 'github.com/edgexfoundry/app-functions-sdk-go/v2 v' | sed 's/require//g' | awk '{print $$2}')
MICROSERVICE=app-service-configurable
GOFLAGS=-ldflags "-X github.com/edgexfoundry/app-functions-sdk-go/v2/internal.SDKVersion=$(SDKVERSION) -X github.com/edgexfoundry/app-functions-sdk-go/v2/internal.ApplicationVersion=$(APPVERSION)"
GIT_SHA=$(shell git rev-parse HEAD)
build:
go mod tidy
$(GO) build $(GOFLAGS) -o $(MICROSERVICE)
# NOTE: This is only used for local development. Jenkins CI does not use this make target
docker:
docker build \
--build-arg http_proxy \
--build-arg https_proxy \
-f Dockerfile \
--label "git_sha=$(GIT_SHA)" \
-t edgexfoundry/app-service-configurable:$(GIT_SHA) \
-t edgexfoundry/app-service-configurable:${APPVERSION}-dev \
.
test:
$(GO) test -coverprofile=coverage.out ./...
$(GO) vet ./...
gofmt -l .
[ "`gofmt -l .`" = "" ]
./bin/test-go-mod-tidy.sh
./bin/test-attribution-txt.sh
clean:
rm -f $(MICROSERVICE)