forked from pactflow/terraform-provider-pact
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·87 lines (70 loc) · 2.52 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
TEST?=./...
.DEFAULT_GOAL := ci
TRAVIS_COMMIT?=1
export TF_VAR_build_number=$(TRAVIS_COMMIT)
ci:: docker deps bin test acceptance-test
local: build clean
terraform init && \
TF_LOG=DEBUG TF_LOG_PATH=log/tf.log terraform apply -auto-approve
build:
go build -o bin/terraform-provider-pact
mkdir -p ~/.terraform.d/plugins/
cp bin/terraform-provider-pact ~/.terraform.d/plugins/
clean:
mkdir -p ./log && \
touch terraform.tfstate terraform.tfstate.backup log/tf.log && \
rm terraform.tf* log/tf.log
docker:
docker-compose up -d
bin:
gox -os="darwin" -arch="amd64" -output="bin/terraform-provider-pact_{{.OS}}_{{.Arch}}"
gox -os="windows" -arch="386" -output="bin/terraform-provider-pact_{{.OS}}_{{.Arch}}"
gox -os="linux" -arch="386" -output="bin/terraform-provider-pact_{{.OS}}_{{.Arch}}"
gox -os="linux" -arch="amd64" -output="bin/terraform-provider-pact_{{.OS}}_{{.Arch}}"
@echo "==> Results:"
ls -hl bin/
deps:
@echo "--- 🐿 Fetching build dependencies "
go get github.com/axw/gocov/gocov
go get github.com/mattn/goveralls
go get golang.org/x/tools/cmd/cover
go get github.com/modocache/gover
go get github.com/mitchellh/gox
goveralls:
goveralls -service="travis-ci" -coverprofile=coverage.txt -repotoken $(COVERALLS_TOKEN)
test:
@echo "--- ✅ Running tests"
@if [ -f coverage.txt ]; then rm coverage.txt; fi;
@echo "mode: count" > coverage.txt
@for d in $$(go list ./... | grep -v vendor | grep -v examples); \
do \
go test -race -coverprofile=profile.out -covermode=atomic $$d; \
if [ -f profile.out ]; then \
cat profile.out | tail -n +2 >> coverage.txt; \
rm profile.out; \
fi; \
done; \
go tool cover -func coverage.txt
oss-acceptance-test: docker
echo "--- Running OSS acceptance tests"
cd acceptance/oss && \
terraform init && \
terraform apply -auto-approve && \
terraform destroy -auto-approve
pactflow-acceptance-test:
echo "--- Running Pactflow acceptance tests"
cd acceptance/pactflow && \
terraform init && \
terraform apply -auto-approve && \
terraform destroy -auto-approve
binary-acceptance-test:
echo "--- Checking binary acceptance test"
mkdir -p ~/.terraform.d/plugins
cp bin/terraform-provider-pact_linux_amd64 ~/.terraform.d/plugins/terraform-provider-pact
terraform init
acceptance-test: binary-acceptance-test oss-acceptance-test pactflow-acceptance-test
echo "--- ✅ Acceptance tests complete"
release:
echo "--- 🚀 Releasing it"
"$(CURDIR)/scripts/release.sh"
.PHONY: build clean local bin deps goveralls release acceptance-test docker oss-acceptance-test