forked from alexandrst88/terraform-variables-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (31 loc) · 1.69 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
VERSION = 1.0.1
CUR_DIR = $(shell pwd)
WORKSPACE = /go/src/github.com/hanks/terraform-variables-generator
DEV_IMAGE = hanks/tfvargen-dev:1.1.0
OS = $(shell uname -s | tr '[:upper:]' '[:lower:]')
.PHONY: dev run push build test debug install uninstall clean
default: test
dev:
docker build -t $(DEV_IMAGE) .
run:
docker run -it --rm -v $(CUR_DIR):$(WORKSPACE) $(DEV_IMAGE) go run main.go cmd
push:
docker push $(DEV_IMAGE)
build: test clean
docker run -it --rm -v $(CUR_DIR):$(WORKSPACE) -e "CGO_ENABLED=0" -e "GOARCH=amd64" -e "GOOS=linux" $(DEV_IMAGE) go build -o ./dist/bin/tfvargen_linux_amd64_$(VERSION) main.go
docker run -it --rm -v $(CUR_DIR):$(WORKSPACE) -e "CGO_ENABLED=0" -e "GOARCH=amd64" -e "GOOS=darwin" $(DEV_IMAGE) go build -o ./dist/bin/tfvargen_darwin_amd64_$(VERSION) main.go
test:
docker run -it --rm -v $(CUR_DIR):$(WORKSPACE) $(DEV_IMAGE) sh -c 'go vet $$(go list ./...)'
docker run -it --rm -v $(CUR_DIR):$(WORKSPACE) $(DEV_IMAGE) sh -c 'golint -set_exit_status $$(go list ./...)'
docker run -it --rm -v $(CUR_DIR):$(WORKSPACE) $(DEV_IMAGE) sh -c 'go test -v -covermode=count -coverprofile=coverage.out $$(go list ./... | grep -v /configs | grep -v /version)'
docker run -it --rm -v $(CUR_DIR):$(WORKSPACE) $(DEV_IMAGE) go tool cover -html=coverage.out -o coverage.html
coveralls:
docker run -it --rm -v $(CUR_DIR):$(WORKSPACE) $(DEV_IMAGE) goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $(COVERALLS_TOKEN)
debug:
docker run -it --rm --security-opt=seccomp:unconfined -v $(CUR_DIR):$(WORKSPACE) $(DEV_IMAGE) dlv debug main.go
install:
cp ./dist/bin/tfvargen_$(OS)_amd64_$(VERSION) /usr/local/bin/tfvargen
uninstall:
rm /usr/local/bin/tfvargen
clean:
rm -rf ./dist