forked from mintel/gcp-quota-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (29 loc) · 860 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
33
34
35
36
SHELL := /bin/sh
BINARY_NAME ?= gcp-quota-exporter
DOCKER_REGISTRY ?= mintel
DOCKER_IMAGE = ${DOCKER_REGISTRY}/${BINARY_NAME}
VERSION ?= $(shell echo `git symbolic-ref -q --short HEAD || git describe --tags --exact-match` | tr '[/]' '-')
DOCKER_TAG ?= ${VERSION}
ARTIFACTS = /tmp/artifacts
build : gcp-quota-exporter
.PHONY : build
gcp-quota-exporter : main.go
@echo "building go binary"
@CGO_ENABLED=0 GOOS=linux go build .
test : check-test-env
@if [[ ! -d ${ARTIFACTS} ]]; then \
mkdir ${ARTIFACTS}; \
fi
go test -v -coverprofile=c.out
go tool cover -html=c.out -o coverage.html
mv coverage.html /tmp/artifacts
rm c.out
.PHONY : test
check-test-env :
ifndef GOOGLE_PROJECT_ID
$(error GOOGLE_PROJECT_ID is undefined)
endif
ifndef GOOGLE_APPLICATION_CREDENTIALS
$(error GOOGLE_APPLICATION_CREDENTIALS is undefined)
endif
.PHONY : check-env