forked from pact-foundation/pact-workshop-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (48 loc) · 1.9 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
include ./make/config.mk
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;\
fi
run-consumer:
@go run consumer/client/cmd/main.go
run-provider:
@go run provider/cmd/usersvc/main.go
deploy-consumer: install
@echo "--- ✅ Checking if we can deploy consumer"
@pact-broker can-i-deploy \
--pacticipant $(CONSUMER_NAME) \
--broker-base-url ${PACT_BROKER_PROTO}://$(PACT_BROKER_URL) \
--broker-username $(PACT_BROKER_USERNAME) \
--broker-password $(PACT_BROKER_PASSWORD) \
--latest
deploy-provider: install
@echo "--- ✅ Checking if we can deploy provider"
@pact-broker can-i-deploy \
--pacticipant $(PROVIDER_NAME) \
--broker-base-url ${PACT_BROKER_PROTO}://$(PACT_BROKER_URL) \
--broker-username $(PACT_BROKER_USERNAME) \
--broker-password $(PACT_BROKER_PASSWORD) \
--latest
publish: install
@echo "--- 📝 Publishing Pacts"
go run consumer/client/pact/publish.go
@echo
@echo "Pact contract publishing complete!"
@echo
@echo "Head over to $(PACT_BROKER_PROTO)://$(PACT_BROKER_URL) and login with"
@echo "=> Username: $(PACT_BROKER_USERNAME)"
@echo "=> Password: $(PACT_BROKER_PASSWORD)"
@echo "to see your published contracts. "
unit:
@echo "--- 🔨Running Unit tests "
go test github.com/pact-foundation/pact-workshop-go/consumer/client -run 'TestClientUnit'
consumer: export PACT_TEST := true
consumer: install
@echo "--- 🔨Running Consumer Pact tests "
go test -count=1 github.com/pact-foundation/pact-workshop-go/consumer/client -run 'TestClientPact'
provider: export PACT_TEST := true
provider: install
@echo "--- 🔨Running Provider Pact tests "
go test -count=1 -tags=integration github.com/pact-foundation/pact-workshop-go/provider -run "TestPactProvider"
.PHONY: install deploy-consumer deploy-provider publish unit consumer provider