forked from pact-foundation/pact-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·78 lines (59 loc) · 2.03 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
include make/config.mk
TEST?=./...
.DEFAULT_GOAL := ci
ci:: docker deps snyk clean bin test pact goveralls
docker:
@echo "--- 🛠 Starting docker"
docker-compose up -d
bin:
gox -os="darwin" -arch="amd64" -output="build/pact-go_{{.OS}}_{{.Arch}}"
gox -os="windows" -arch="386" -output="build/pact-go_{{.OS}}_{{.Arch}}"
gox -os="linux" -arch="386" -output="build/pact-go_{{.OS}}_{{.Arch}}"
gox -os="linux" -arch="amd64" -output="build/pact-go_{{.OS}}_{{.Arch}}"
@echo "==> Results:"
ls -hl build/
clean:
rm -rf build output dist
deps: snyk-install
@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)
install:
@if [ ! -d pact/bin ]; then\
@echo "--- 🐿 Installing Pact CLI dependencies"; \
curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/master/install.sh | bash -x; \
fi
pact: install docker
@echo "--- 🔨 Running Pact examples"
go test -tags=consumer -count=1 github.com/pact-foundation/pact-go/examples/... -run TestExample
go test -tags=provider -count=1 github.com/pact-foundation/pact-go/examples/... -run TestExample
release:
echo "--- 🚀 Releasing it"
"$(CURDIR)/scripts/release.sh"
test: deps install
@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
testrace:
go test -race $(TEST) $(TESTARGS)
updatedeps:
go get -d -v -p 2 ./...
snyk-install:
npm i -g snyk
snyk:
snyk test
.PHONY: install bin default dev test pact updatedeps clean release