-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
48 lines (40 loc) · 1.15 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
NAME := aws_cost_waste
MAINTAINER := cachelab
VERSION := $(shell grep "const version =" main.go | cut -d\" -f2)
AWS_REGION := us-east-1
AWS_ACCESS_KEY_ID=$(shell aws configure get aws_access_key_id)
AWS_SECRET_ACCESS_KEY=$(shell aws configure get aws_secret_access_key)
.PHONY: *
default: run
run: build
docker run \
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
-e AWS_REGION=${AWS_REGION} \
${MAINTAINER}/${NAME}
build: vet
@echo Building Binary and Container
@go build -o ${NAME}
@docker build -t ${MAINTAINER}/${NAME} .
vet:
@echo Formatting Code
@go fmt ./...
@echo Vetting Code
@go vet .
push: build
docker tag ${MAINTAINER}/${NAME}:latest ${MAINTAINER}/${NAME}:${VERSION}
docker push ${MAINTAINER}/${NAME}:latest
docker push ${MAINTAINER}/${NAME}:${VERSION}
test:
@echo Running Unit Tests
@mkdir -p .coverage
@GOOS=darwin \
AWS_ACCESS_KEY_ID=abc123 \
AWS_SECRET_ACCESS_KEY=abc123 \
AWS_REGION=us-east-1 \
go test -tags test -coverprofile=/tmp/cov.out ./...
@go tool cover -html=/tmp/cov.out -o=.coverage/cov.html
@open .coverage/cov.html
tag:
git tag v${VERSION}
git push origin --tags