-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathMakefile
71 lines (58 loc) · 1.5 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
64
65
66
67
68
69
70
71
PACKAGE := terraform-provider-signalform
GOPATH := $(shell pwd -L)
BASE := $(GOPATH)/src/$(PACKAGE)
PATH := $(GOPATH)/bin:$(PATH)
GLIDE := glide
export GOPATH
export PATH
# unset GOROOT avoids: "go test error: cannot use matchString as type testing.testDeps in argument to testing.MainStart"
unexport GOROOT
unexport SFX_AUTH_TOKEN
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
export GOOS
export GOARCH
.PHONY: all
all: fmt .git/hooks/pre-commit test build itest_trusty itest_xenial itest_bionic
.PHONY: fmt
fmt:
go fmt ./...
deps:
@echo Getting dependencies...
@go get github.com/Masterminds/glide
@cd src/github.com/Masterminds/glide && git checkout --quiet v0.12.3
@go build -o bin/glide github.com/Masterminds/glide/
@cd $(BASE) && $(GLIDE) install
@touch deps
.PHONY: clean
clean:
rm -rf bin
rm -rf pkg
make -C build clean
rm -f deps
rm -rf src/terraform-provider-signalform/vendor
.PHONY: build
build: test
mkdir -p $(GOPATH)/bin
cd $(BASE) && go build -o $(GOPATH)/bin/terraform-provider-signalform
.PHONY: integration
integration:
make -C test
.PHONY: itest_%
itest_%:
mkdir -p dist
make -C build $@
.PHONY: package
package: itest_trusty itest_xenial itest_bionic
.PHONY: binary
binary:
mkdir -p dist
make -C build binary
.PHONY: test
test: deps
cd $(BASE) && go test -v $$(glide novendor) ${TEST_OPTS}
.PHONY: changelog
changelog:
make -C build $@
.git/hooks/pre-commit:
if [ ! -f .git/hooks/pre-commit ]; then ln -s ../../git-hooks/pre-commit .git/hooks/pre-commit; fi